// source --> https://www.carminedisiero.it/wp-content/themes/june/js/codeless-main.js?ver=5.4 ( function( $ ) { "use strict"; var CL_FRONT = window.CL_FRONT || {}; window.CL_FRONT = CL_FRONT; CL_FRONT.components = CL_FRONT.components || {}; CL_FRONT.helpers = CL_FRONT.helpers || {}; /** * Main Site Init * * @since 1.0.0 */ CL_FRONT.siteInit = function() { "use strict"; this.defaultConfig(); this.bindEvents(); }; /** * Init Default Variables * * @since 1.0.0 */ CL_FRONT.defaultConfig = function() { "use strict"; this.config = { // Load dynamic scripts _loadedDependencies: [], _inQueue: {}, // Default Config $window: $( window ), $document: $( document ), $windowWidth: $( window ).width(), $windowHeight: $( window ).height(), $windowTop: typeof window.pageYOffset != 'undefined' ? window.pageYOffset: document.documentElement.scrollTop? document.documentElement.scrollTop: document.body.scrollTop? document.body.scrollTop:0, $containerWidth: 0, $containerOffsetLeft: 0, $html: $( 'html' ), $body: $( 'body' ), $viewport: $( '#viewport' ), $header: $( '.header_container' ), $headerTools: $('.header_container .extra_tools_wrapper'), $initSliders : {}, $navigation: $( '.cl-header-menu' ), //$navigation: $( '.cl-primary-navigation.use-for-responsive' ), $customResponsiveNavigation : $( '.cl-custom-responsive-navigation' ), $responsiveMenu: null, $content: $( '#content' ), $aside: $( '#secondary' ), $main: $( '#main' ), $pageLayout: 'fullwidth', $headerHeight: 0, $layoutModern: false, $asideTop: 0, $asideHeight: 0, $asideStickyOffset: 0, $isMobileScreen: false, $isTabletScreen: false, $isDesktopScreen: false, $isMobileDevice: false, $isMobileOrTabletDevice: false, $isSmoothScroll: false, $isCustomizer: false, $headerToolsInit: false, $headerToolsList: [], $cssInQueue: {}, } }; /** * Bind Events of site * * @since 1.0.0 * @version 1.0.2 */ CL_FRONT.bindEvents = function() { "use strict"; var self = this; // Document Ready self.config.$document.ready( function() { self.updateConfig(); self.loadAsyncIcons(); // Menu self.initMenuDropdown(); self.initToolsDropdown(); self.initMenuResponsive(); self.responsiveFixes(); self.initToolsResponsive(); self.initHeaderStyles(); self.initHeaderSticky(); self.headerSearch(); self.searchAutoComplete(); // Initialize Post Functionalities self.postInit(); // Infinite Pagination self.paginationInfinite(); self.isotopeBlogGrid(); self.isotopePortfolioGrid(); self.itemILightBox(); // Various sizes and positions fixes self.fixModernLayoutWidth(); self.fixPostVideoHeight(); self.fixCompatibilities(); self.fixMegaMenuPosition(); self.init_cl_page_header(); if( ! self.config.$isCustomizer ){ self.codelessSlider(); }else{ $('.cl_slider').addClass('loading-on-end loading-end'); } self.testimonialCarousel(); self.clientsCarousel(); self.teamCarousel(); self.galleryCarousel(); self.rowParallax(); self.progressBar(); self.mediaElement(); self.codelessGMap(); self.contactForm(); self.codelessToggles(); self.codelessTabs(); self.shopFixes(); self.shopInit(); self.instaFeed(); self.shopBtnClasses(); self.creativeSearch(); self.partialRefreshRendered(); self.cl_woocommerce_add_to_cart_variable(); self.footerReveal(); self.pageTransition(); self.countdownElement(); if( $('.lazyload').length > 0 ) self.components.LazyLoad(); self.onePageScroll(); self.shopTabbed(); self.closedSections(); self.sideNavigation(); self.multiscroll(); self.quickView(); self.ajaxProductAdd(); self.equalHeightMobile(); self.sideCart(); self.nanoScroller(); self.xBrowserFixes(); self.addedToWishlist(); self.scrollToTopButton(); } ); // Window load self.config.$window.on( 'load', function() { self.postInstagram(); self.livePhoto(); self.convertSVGAnimated(); self.rowParallax(); self.shopBtnClasses(); //self.shopProductThumbnails(); self.shopInit(); $('.stars > span > a').on('click', function(){ var $container = $(this).closest('.cl-review-info'); if( ! $container.hasClass('show-all') ) $container.addClass('show-all'); }); } ); // Window Resize self.config.$window.resize( function() { self.updateDimensions(); self.initMenuResponsive(); self.initToolsResponsive(); self.fixModernLayoutWidth(); self.fixPostVideoHeight(); self.stickySidebar(); //self.stickyColumn(); self.fixPageHeaderCenter(); self.initHeaderSticky(); self.headerSearch(); self.equalHeightMobile(); } ); // Window Scroll self.config.$window.scroll( function() { self.config.$windowTop = typeof window.pageYOffset != 'undefined' ? window.pageYOffset: document.documentElement.scrollTop? document.documentElement.scrollTop: document.body.scrollTop? document.body.scrollTop:0;; self.stickySidebar(); //self.stickyColumn(); } ); // Window on Orientation Change Tablets self.config.$window.on( 'orientationchange', function() { self.updateDimensions(); self.initMenuResponsive(); self.initToolsResponsive(); self.fixPageHeaderCenter(); self.footerReveal(); } ); self.config.$window.on( 'click', function(e) { if( $(e.target).closest( '.cl-review-info' ) || $(e.target).is( '.cl-reivew-info' ) ) return; $('.cl-review-info').removeClass('show-all'); } ); }; /** * Update Config Dom * * @since 1.0.0 */ CL_FRONT.updateConfig = function() { this.config.$html = $( 'html' ); this.config.$body = $( 'body' ); this.config.$viewport = $( '#viewport' ); this.config.$header = $( '.header_container' ); this.config.$navigation = $( '.cl-header-menu' ); this.config.$navigationResponsive = $( '.cl-primary-navigation.use-for-responsive' ); this.config.$customResponsiveNavigation = $( '.cl-custom-responsive-navigation' ); this.config.$headerTools = $('.header_container .extra_tools_wrapper'); this.config.$content = $( '#content' ); this.config.$aside = $( '#secondary' ); this.config.$main = $( '#main' ); this.config.$pageLayout = this.config.$content.hasClass( 'cl-layout-left_sidebar' ) ? 'left_sidebar' : this.config.$content.hasClass( 'cl-layout-right_sidebar' ) ? 'right_sidebar' : this.config.$content.hasClass( 'cl-layout-dual' ) ? 'dual_sidebar' : 'fullwidth'; if ( this.config.$content.hasClass( 'cl-layout-modern' ) ) this.config.$layoutModern = true; this.config.$isMobileDevice = this.mobileDeviceCheck(); this.config.$isMobileOrTabletDevice = this.mobileOrTabletDeviceCheck(); this.config.$isSmoothScroll = this.config.$body.hasClass( 'cl-smoothscroll' ) ? true : false; if( $('.cl_counter').length > 0 ) this.preloadOdometer(); this.updateDimensions(); }; /** * Check if page is loaded from mobile * * @since 1.0.0 */ CL_FRONT.mobileDeviceCheck = function() { var check = false; ( function( a ) { if ( /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test( a ) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test( a.substr( 0, 4 ) ) ) check = true; } )( navigator.userAgent || navigator.vendor || window.opera ); return check; } /** * Check if page is loaded from mobile or tablet * * @since 1.0.0 */ CL_FRONT.mobileOrTabletDeviceCheck = function() { var check = false; ( function( a ) { if ( /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test( a ) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test( a.substr( 0, 4 ) ) ) check = true; } )( navigator.userAgent || navigator.vendor || window.opera ); return check; } /** * Update Dimension of page, used on screen resize * * @since 1.0.0 */ CL_FRONT.updateDimensions = function() { this.config.$windowWidth = $( window ).width(); this.config.$windowHeight = $( window ).height(); if ( window.matchMedia ) { this.config.$isMobileScreen = window.matchMedia( '( max-width: 767px )' ).matches; this.config.$isTabletScreen = window.matchMedia( '( min-width: 768px ) and (max-width: 991px)' ).matches; this.config.$isDesktopScreen = window.matchMedia( '( min-width: 992px )' ).matches; } else { this.config.$isMobileScreen = this.config.$windowWidth <= 768; this.config.$isTabletScreen = this.config.$windowWidth > 768 && this.config.$windowWidth <= 991; this.config.$isDesktopScreen = this.config.$windowWidth > 992; } this.config.$containerWidth = this.config.$header.hasClass('header-top') ? this.config.$header.find( '.header-row-inner' ).width() : this.config.$content.find( '.container' ).width(); if( this.config.$header.hasClass('header-top') ){ this.config.$containerOffsetLeft = this.config.$header.find( '.c-left.header-col' ).length > 0 ? this.config.$header.find( '.c-left.header-col' ).offset().left : this.config.$content.find( '.container' ).offset().left - 15; }else this.config.$containerOffsetLeft = 0; var container_offset = this.config.$content.find( '.container' ).length > 0 ? this.config.$content.find( '.container' ).offset().left : 0 this.config.$containerOffsetLeft = this.config.$header.hasClass('header-top') ? this.config.$header.find( '.c-left.header-col' ).offset().left : container_offset - 15; this.config.$headerHeight = this.config.$header.height(); } CL_FRONT.fixCompatibilities = function(){ if( bowser.msie && bowser.version <= 9 ){ CL_FRONT.components.loadDependencies( [ codeless_global.FRONT_LIB_JS + 'jquery.requestAnimationFrame.js'], function(){ }); CL_FRONT.config.$html.addClass('no-cssanimations'); } } CL_FRONT.equalHeightMobile = function(){ if( $( '.cl_row-equal_height' ).length == 0 ) return; $( '.cl_row-equal_height:not(.cl_row-fullheight)' ).each(function(){ var $row = $(this); var $cols = $row.find( '.cl-element.cl_column' ); $row.imagesLoaded(function(){ if( CL_FRONT.config.$isMobileScreen ){ var $col = $cols.first().find( '.cl_column_inner' ).first(); if( $col.length == 0 ) $col = $cols.first(); var $height = $col.height(); setTimeout(function(){ if( $col.hasClass('cl_column_inner') ) $cols.not($col).css('min-height', $height + 'px'); else $cols.not($col).height( $height + 'px' ); }, 100); }else{ $cols.css('height', ''); } }) }); } CL_FRONT.xBrowserFixes = function(){ "use strict"; if(bowser.gecko){ if( $('.qty').length > 0 ){ $('.qty').each(function(){ var $parent = $(this).parent(); $parent.addClass('firefox-fix'); }) } } } /** * Initialize Menu in Responsive * * @since 1.0.0 */ CL_FRONT.initMenuResponsive = function() { "use strict"; var self = this; if( this.config.$windowWidth <= 991 && this.config.$responsiveMenu === null ){ if( this.config.$navigationResponsive.closest('.cl-fullscreen-overlay-menu').length == 0 ) this.config.$navigationResponsive.addClass('cl-hide-on-mobile'); else{ this.config.$navigationResponsive.addClass('vertical-menu').addClass('cl-mobile-menu'); return; } this.config.$responsiveMenu = this.config.$navigationResponsive.clone(); if( this.config.$customResponsiveNavigation.length > 0 ){ this.config.$responsiveMenu = this.config.$customResponsiveNavigation; this.config.$customResponsiveNavigation.remove(); } this.config.$responsiveMenu.appendTo(this.config.$header); this.config.$responsiveMenu.removeClass( 'cl-hide-on-mobile' ).addClass( 'cl-mobile-menu' ); $( '.cl-mobile-menu-button' ).on( 'click', function( ){ var button = $(this); button.toggleClass( 'open' ); self.config.$responsiveMenu.slideToggle('200'); CL_FRONT.animations( self.config.$responsiveMenu , true ); } ); $( 'nav li.hasSubMenu > a', this.config.$responsiveMenu ).on( 'click', function( e ){ var li = $(this).parent(); e.preventDefault(); li.toggleClass('open'); li.parent().find('li').not(li).removeClass('open'); li.children( '.sub-menu, .codeless_custom_menu_mega_menu' ).slideToggle('300'); } ); $( 'nav .codeless_custom_menu_mega_menu > ul > li.hasSubMenu', this.config.$responsiveMenu ).on( 'click', function( e ){ var li = $(this), element = e.target || e.srcElement; if( element.nodeName != 'A' ){ li.toggleClass('open'); li.parent().find('li').not(li).removeClass('open'); li.children( '.sub-menu' ).slideToggle('300'); } } ); }else{ if( this.config.$responsiveMenu != null ) this.config.$responsiveMenu.addClass('cl-hide-not-mobile'); if( typeof this.config.$navigationResponsive !== 'undefined' && this.config.$navigationResponsive.closest('.cl-fullscreen-overlay-menu').length > 0 ){ this.config.$navigationResponsive.removeClass('cl-mobile-menu'); return; } } if( this.config.$windowWidth > 991 ) this.config.$header.removeClass('cl-responsive-header'); else this.config.$header.addClass('cl-responsive-header'); } CL_FRONT.responsiveFixes = function(){ "use strict"; if( $( '.cl-mobile-menu-button', '.extra_row' ).length > 0 || $( '.header-el:not(.cl-h-cl_header_menu)', '.extra_row' ).length > 0 ){ $('.header_container.header-top > .extra_row, .header_container.header-bottom > .extra_row').addClass('not-empty-row'); } if( $('.cl-h-cl_header_tools').length > 1 ){ $('.cl-h-cl_header_tools').each(function(index){ if(index != $('.cl-h-cl_header_tools').length - 1) $(this).find('.cl-mobile-menu-button').remove(); }); } } /** * This function init all related functions of a specific header or menu style * * @since 1.0.0 */ CL_FRONT.initHeaderStyles = CL_FRONT.init_cl_header_menu = function(){ "use strict"; // Hamburger - overlay if( $('.cl-overlay-menu').length > 0 ){ CL_FRONT.overlayMenu(); }else if( this.config.$header.hasClass('header-left') || this.config.$header.hasClass('header-right') ) { CL_FRONT.initHeaderSide(); } setTimeout(function(){ CL_FRONT.animations( $('#navigation'), true ); }, 300); }, CL_FRONT.initHeaderSide = function(){ }, CL_FRONT.sideCart = function(){ if( $('.cart-style-side').length == 0 ) return; var $tool = $('.cart-style-side').closest('.shop.tool'); var $btn = $tool.find('.tool-link'); $btn.on('click', function(e){ e.preventDefault(); if( CL_FRONT.config.$body.hasClass('open-side-cart') ){ CL_FRONT.config.$body.removeClass('open-side-cart'); $('html').css('overflow', ''); } else{ $('html').css('overflow', 'hidden'); CL_FRONT.config.$body.addClass('open-side-cart'); } }); $('.cart-style-side').find( '.close' ).on('click', function(e){ e.preventDefault(); $('html').css('overflow', ''); CL_FRONT.config.$body.removeClass('open-side-cart'); }) } /** * Init Header Sticky * * @since 1.0.0 * @version 1.0.8 */ CL_FRONT.initHeaderSticky = function(){ "use strict"; if( ! this.config.$header.hasClass( 'cl-header-sticky' ) ) return; var is_active = false; if( !CL_FRONT.config.$header.hasClass('cl-transparent') && CL_FRONT.config.$isDesktopScreen ){ var header_height = CL_FRONT.config.$header.height(); CL_FRONT.config.$main.css({ marginTop: header_height+'px', }); }else{ CL_FRONT.config.$main.css({ marginTop: '0px', }); } var onScroll = function(){ if( ! CL_FRONT.config.$header.hasClass( 'cl-header-sticky' ) ) return; var stickyContentColor = CL_FRONT.helpers.parseData( CL_FRONT.config.$header.attr('data-sticky-content-color'), 'dark' ); var site_header = CL_FRONT.config.$body.hasClass('cl-header-light') ? 'light' : 'dark'; if( CL_FRONT.config.$windowTop > 500 && ! is_active ){ setTimeout(function(){ CL_FRONT.config.$header.addClass('cl-header-sticky-prepare'); }, 100); if( stickyContentColor == 'dark' ) CL_FRONT.config.$header.removeClass('cl-header-light'); if( stickyContentColor == 'light' && site_header == 'dark' ) CL_FRONT.config.$header.addClass('cl-header-light'); setTimeout( function(){ if( CL_FRONT.config.$windowTop > 510 ) CL_FRONT.config.$header.addClass('cl-header-sticky-ready'); }, 400); setTimeout( function(){ if( CL_FRONT.config.$windowTop > 510 ){ CL_FRONT.config.$header.addClass('cl-header-sticky-active'); is_active = true; } }, 600); }else if( CL_FRONT.config.$windowTop <= 500 ) { CL_FRONT.config.$header.removeClass('cl-header-sticky-active'); if( site_header == 'dark' ){ CL_FRONT.config.$header.removeClass('cl-header-light'); } else if( site_header == 'light' && ! CL_FRONT.config.$header.hasClass('cl-header-light') ) CL_FRONT.config.$header.addClass('cl-header-light'); setTimeout( function(){ CL_FRONT.config.$header.removeClass('cl-header-sticky-ready'); }, 100); setTimeout( function(){ CL_FRONT.config.$header.removeClass('cl-header-sticky-prepare'); is_active = false; }, 100); } } window.addEventListener('scroll', onScroll, false); }, /** * Bind hamburger click and open overlay * * @since 1.0.0 * @version 1.0.6 */ CL_FRONT.overlayMenu = function(){ "use strict"; $('.cl-hamburger-menu').on( 'click', function(e){ e.preventDefault(); if( $('.cl-hamburger-menu').hasClass( 'open' ) ){ setTimeout( function(){ $('.cl-hamburger-menu').removeClass( 'open' ); CL_FRONT.config.$header.removeClass('cl-actived-fullscreen-header'); }, 500); }else{ $('.cl-hamburger-menu').addClass( 'open' ); CL_FRONT.config.$header.addClass('cl-actived-fullscreen-header'); } $('.cl-overlay-menu').toggleClass( 'open' ); if( $('#navigation .animate_on_visible').length > 0 && $('.cl-overlay-menu').hasClass( 'open' ) ){ setTimeout(function(){ CL_FRONT.animations( $('#navigation'), true ); }, 500); } if( $('#navigation .animate_on_visible').length > 0 && ! $('.cl-overlay-menu').hasClass( 'open' ) ){ setTimeout(function(){ $('#navigation .animate_on_visible').removeClass('start_animation'); }, 500); } } ); }, /** * Page transition Effects * * @since 1.0.0 */ CL_FRONT.pageTransition = function(){ "use scrict"; if( ! this.config.$viewport.hasClass( 'animsition' ) ) return; $(".animsition").animsition({ inClass : $(this).data('animsition-in'), outClass : $(this).data('animsition-out'), inDuration : $(this).data('animsition-in-duration'), outDuration : $(this).data('animsition-out-duration'), linkElement : 'a:not([target="_blank"]):not([href^="#"]):not(.lightbox-gallery):not(.entry-link.lightbox):not([class^="ilightbox-"]):not(.zoom):not(.prettyphoto)' }); }, CL_FRONT.sideNavigation = function(){ "use scrict"; if( $('.cl-sidenav ul').length == 0 ) return; var $element = $('.cl-sidenav ul'); var $parent = $element.closest( '.cl-sidenav' ); var scrollHeight = $element[0].scrollHeight; var elementHeight = $element.height(); var activedOffset = $element.find('.current_page_item')[0].offsetTop; var val = $element.scrollTop(); if( val == null ) val = 0; $element.scroll(function(){ val = $(this).scrollTop(); calc(); }); var calc = function(){ if( val <= 90 ) $parent.addClass('hideBefore'); else $parent.removeClass('hideBefore'); if( val + elementHeight >= scrollHeight - 90 ) $parent.addClass('hideAfter'); else $parent.removeClass('hideAfter'); }; if( activedOffset < elementHeight - 90 || activedOffset < 90 ) $element[0].scrollTop = 0; else if( activedOffset > elementHeight - 90 || activedOffset < scrollHeight - 90) $element[0].scrollTop = activedOffset; calc(); }, CL_FRONT.searchAutoComplete = function(){ if( $('.header_container .search-element').length == 0 ) return; var url = codeless_global.ajax_url + '?action=codeless_search_autocomplete', form = $('.header_container .search-element .search-form'), escapeRegExChars = function (value) { return value.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); }; CL_FRONT.components.loadDependencies( [ codeless_global.FRONT_LIB_JS + 'jquery.autocomplete.min.js' ], function() { form.each(function() { var $this = $(this), number = 10, product_cat = $this.find('#clcat').val(), $results = $this.find('.ajax-results'), postType = 'product'; if( number > 0 ) { url += '&number=' + number; } url += '&post_type=' + postType; if(product_cat) { url += '&product_cat=' + product_cat; } $this.find('[type="search"]').autocomplete({ serviceUrl: url, appendTo: $results, onSelect: function (suggestion) { if( suggestion.permalink.length > 0) window.location.href = suggestion.permalink; }, onSearchStart: function (query) { $this.addClass('search-loading'); }, beforeRender: function (container) { }, onSearchComplete: function(query, suggestions) { $this.removeClass('search-loading'); CL_FRONT.components.loadDependencies( [ codeless_global.FRONT_LIB_JS + 'jquery.nanoscroller.min.js' ], function() { if( $(window).width() >= 1024 ) { $(".nano").nanoScroller({ preventPageScrolling: !1 }); } }); $results.addClass('show'); setTimeout(function(){ $results.addClass('show-2'); }, 300); }, onHide: function(){ $results.removeClass('show-2'); setTimeout(function(){ $results.removeClass('show'); }, 100); }, formatResult: function( suggestion, currentValue ) { if( currentValue == '&' ) currentValue = "&"; var pattern = '(' + escapeRegExChars(currentValue) + ')', returnValue = ''; returnValue += '
' + suggestion.value .replace(new RegExp(pattern, 'gi'), '$1<\/strong>') // .replace(/&/g, '&') .replace(//g, '>') .replace(/"/g, '"') .replace(/-/g, '—') .replace(/<(\/?strong)>/g, '<$1>') + '
'; if ( suggestion.no_found ) returnValue = '
' + suggestion.value + '
'; return returnValue; } }); }); }); } CL_FRONT.shopFixes = function(){ "use strict"; $('.shop-products .tawcvs-swatches[data-attribute_name="attribute_pa_size"]').closest('tr').addClass('hide'); $('.single-product .cl-info.gift .in-gift').mouseenter(function(){ }); $('.single-product .cl-info.gift').on('click', function(){ if( $(this).hasClass('show-tooltip') ) $(this).removeClass('show-tooltip'); else{ $(this).focus(); $(this).addClass('show-tooltip'); } }); $('.single-product .cl-info.gift').on('blur', function(){ $(this).removeClass('show-tooltip'); }) $( '.woocommerce.widget_layered_nav .widget-title, .widget_price_filter .widget-title' ).on('click', function(){ var $parent = $( this ).closest( '.woocommerce.widget_layered_nav, .widget_price_filter' ); if( $parent.hasClass('show-toggle') ) $parent.removeClass('show-toggle'); else $parent.addClass('show-toggle'); }); if( $( 'aside .woocommerce-widget-layered-nav' ).length > 0 ){ if( !codeless_global.shop_open_toggles ) $( 'aside .woocommerce-widget-layered-nav:eq(1)' ).addClass( 'show-toggle' ); else $( 'aside .woocommerce-widget-layered-nav' ).addClass( 'show-toggle' ); $( '

Filter By

' ).insertBefore( 'aside .woocommerce-widget-layered-nav:eq(0)' ); } if( $( '.widget_price_filter' ).length > 0 ){ $( '.widget_price_filter' ).addClass( 'show-toggle' ); } if( $( '.yith-woocommerce-ajax-product-filter' ).length > 0 ){ $( '.yith-woocommerce-ajax-product-filter' ).addClass('show-toggle'); } $(document).on("yith-wcan-ajax-filtered", function(response){ CL_FRONT.animations( response[0], true ); CL_FRONT.isotopeShop(); CL_FRONT.quickView(); if( $.fn.tawcvs_variation_swatches_form ){ $( '.variations_form', response[0] ).tawcvs_variation_swatches_form(); setTimeout(function(){ CL_FRONT.shopColorChange($( '.variations_form', response[0] )); }, 10); } }); $( '.open-filters' ).on('click', function(e){ e.preventDefault(); var filters = $(this).closest('.content-col').find( '.cl-shop-inpage-filters' ); var wrapper = filters.find( '.filters-wrapper' ); var height = wrapper.outerHeight(); if( !$(this).hasClass('opened') ){ $(this).addClass('opened'); filters.css( 'height', height + 'px' ); setTimeout(function(){ filters.css( 'height', 'auto' ); }, 500); }else{ $(this).removeClass('opened'); filters.css( 'height', '0px' ); } }); $( '.cl-shop-inpage-filters .widget' ).addClass('show-toggle'); if( CL_FRONT.config.$body.hasClass('single-product') ){ console.log('loaded'); $('.single-product-style-center .cl-product-info .cl-images-wrapper').imagesLoaded(function(){ console.log('loaded'); setTimeout(function(){ $('.single-product-style-center .cl-product-info .bg-layer').height( $('.single-product-style-center .cl-product-info .cl-images-wrapper').height() + 270 + 'px' ); }, 50); }); setTimeout(function(){ $('.single-product .cl-image-wrapper .woocommerce-product-gallery').imagesLoaded(function(){ var height = $('.single-product .cl-product-info .flex-viewport').height(); console.log(height); $('.single-product .cl-product-info .flex-direction-nav').height( height + 'px' ); }); }, 200); } CL_FRONT.shopColorChange(); if( CL_FRONT.config.$isMobileScreen ){ $('.shop-entries .product_item .woocommerce-LoopProduct-link').attr('onClick', 'return false'); } if( $('.return-to-shop').length > 0 ){ $('.return-to-shop a').addClass('btn-style-square btn-hover-darker cl-btn'); } } CL_FRONT.addedToWishlist = function(){ $('body').on('added_to_wishlist', function( e, param1, param2 ){ if( param1.hasClass('cl-action') ) param1.addClass('added_to_cart'); if( param1.find('i').length > 0 ) param1.find('i').attr('class', 'cl-icon-check'); }); } CL_FRONT.shopColorChange = function( $forms ){ $forms = $forms || $( '.shop-entries .variations_form' ); setTimeout(function(){ if( $('.swatch.swatch-color').length == 0 ) return; $('.swatch.swatch-color').each(function(){ var color = $(this).css('background-color'); if( color == 'rgb(255, 255, 255)' ){ $(this).addClass('white-color'); } }) }, 400); if ( typeof wc_add_to_cart_variation_params !== 'undefined' ) { $forms.each( function() { var $form = $(this); $form.wc_variation_form(); if( $form.closest('.product').hasClass('masonry_layout_small') ) return; $form.on('found_variation', function(event, variation){ var $product = $(this).closest('.product'); if( variation.image.catalog_src == null ) variation.image.catalog_src = codeless_global.wc_placeholder_img_src; $product.find('img.wp-post-image').attr('src', variation.image.catalog_src) $product.find('img.wp-post-image').attr( 'srcset', ''); $product.find('img.wp-post-image').attr( 'sizes', variation.image.catalog_sizes ); }); }); } } CL_FRONT.cl_woocommerce_add_to_cart_variable = function(){ // wc_add_to_cart_params is required to continue, ensure the object exists if ( typeof wc_add_to_cart_params === 'undefined' ) return false; $('.shop-entries .product_item.style_dark_controllers .ajax_add_to_cart_variable').text(codeless_global.language.add_to_cart); // Ajax add to cart $( document ).on( 'click', '.shop-entries .product_item.product-type-variable:not(.style_list) .ajax_add_to_cart_variable', function(e) { e.preventDefault(); var $variation_form = $( this ).closest( '.product_item' ).find('.variations_form'); var var_id = $variation_form.find( 'input[name=variation_id]' ).val(); var product_id = $variation_form.find( 'input[name=product_id]' ).val(); var quantity = $variation_form.find( 'input[name=quantity]' ).val(); //attributes = []; $( '.ajaxerrors' ).remove(); var item = {}, check = true; var variations = $variation_form.find( 'select[name^=attribute]' ); /* Updated code to work with radio button - mantish - WC Variations Radio Buttons - 8manos */ if ( !variations.length) { variations = $variation_form.find( '[name^=attribute]:checked' ); } /* Backup Code for getting input variable */ if ( !variations.length) { variations = $variation_form.find( 'input[name^=attribute]' ); } variations.each( function() { var $this = $( this ), attributeName = $this.attr( 'name' ), attributevalue = $this.val(), index, attributeTaxName; $this.removeClass( 'error' ); if ( attributevalue.length === 0 ) { index = attributeName.lastIndexOf( '_' ); attributeTaxName = attributeName.substring( index + 1 ); $this //.css( 'border', '1px solid red' ) .addClass( 'required error' ) //.addClass( 'barizi-class' ) .before( '

Please select ' + attributeTaxName + '

' ) check = false; } else { item[attributeName] = attributevalue; } // Easy to add some specific code for select but doesn't seem to be needed // if ( $this.is( 'select' ) ) { // } else { // } } ); if ( !check ) { window.location.href = $(this).attr('href'); } //item = JSON.stringify(item); //alert(item); //return false; // AJAX add to cart request var $thisbutton = $( this ); if ( $thisbutton.is( '.ajax_add_to_cart_variable' ) ) { $thisbutton.removeClass( 'added' ); $thisbutton.addClass( 'loading-add-cart' ); var data = { action: 'codeless_woocommerce_add_to_cart_variable', product_id: product_id, quantity: quantity, variation_id: var_id, variation: item }; // Trigger event $( 'body' ).trigger( 'adding_to_cart', [ $thisbutton, data ] ); // Ajax action $.post( wc_add_to_cart_params.ajax_url, data, function( response ) { if ( ! response ) return; var this_page = window.location.toString(); this_page = this_page.replace( 'add-to-cart', 'added-to-cart' ); if ( response.error && response.product_url ) { window.location = response.product_url; return; } if ( wc_add_to_cart_params.cart_redirect_after_add === 'yes' ) { window.location = wc_add_to_cart_params.cart_url; return; } else { $thisbutton.removeClass( 'loading-add-cart' ); var fragments = response.fragments; var cart_hash = response.cart_hash; // Block fragments class if ( fragments ) { $.each( fragments, function( key ) { $( key ).addClass( 'updating' ); }); } // Block widgets and fragments $( '.shop_table.cart, .updating, .cart_totals' ).fadeTo( '400', '0.6' ).block({ message: null, overlayCSS: { opacity: 0.6 } }); // Changes button classes $thisbutton.addClass( 'added' ); // View cart text if ( ! wc_add_to_cart_params.is_cart && $thisbutton.parent().find( '.added_to_cart' ).size() === 0 ) { $thisbutton.after( ' ' + wc_add_to_cart_params.i18n_view_cart + '' ); } // Replace fragments if ( fragments ) { $.each( fragments, function( key, value ) { $( key ).replaceWith( value ); }); } // Unblock $( '.widget_shopping_cart, .updating' ).stop( true ).css( 'opacity', '1' ).unblock(); // Cart page elements $( '.shop_table.cart' ).load( this_page + ' .shop_table.cart:eq(0) > *', function() { $( '.shop_table.cart' ).stop( true ).css( 'opacity', '1' ).unblock(); $( document.body ).trigger( 'cart_page_refreshed' ); }); $( '.cart_totals' ).load( this_page + ' .cart_totals:eq(0) > *', function() { $( '.cart_totals' ).stop( true ).css( 'opacity', '1' ).unblock(); }); // Trigger event so themes can refresh other areas $( document.body ).trigger( 'added_to_cart', [ fragments, cart_hash, $thisbutton ] ); } }); return false; } else { return true; } }); }; /** * Initialize Post * * @since 1.0.0 */ CL_FRONT.postInit = function( $el ) { "use strict"; this.postSwiper(); this.postLike(); this.postShareCount(); }; CL_FRONT.livePhoto = function(){ "use strict"; if($('#live_photo').length > 0){ var myNewPlayer = LivePhotosKit.Player(); // A Player built from a pre-existing element: LivePhotosKit.Player(document.getElementById('live_photo')); } } CL_FRONT.postInstagram = function() { $( '.entry-video .instagram-media' ).contents().find( '.EmbedCaption' ).remove(); $( '.entry-video .instagram-media' ).contents().find( '.EmbedFooter' ).remove(); } /** * Fix sidebar background Width * * @since 1.0.0 */ CL_FRONT.fixModernLayoutWidth = function() { "use strict"; if ( this.config.$layoutModern ) { if ( this.config.$pageLayout == 'right_sidebar' ) { var distance = this.config.$windowWidth - ( this.config.$aside.offset().left ); $( '.cl-layout-modern-bg' ).width( ( distance + 10 ) + 'px' ); } if ( this.config.$pageLayout == 'left_sidebar' ) { var distance = this.config.$aside.offset().left + this.config.$aside.width(); $( '.cl-layout-modern-bg' ).width( ( distance + 35 ) + 'px' ); } } } /** * Fix Height of custom Masonry Size * * @since 1.0.0 */ CL_FRONT.fixPostMasonryHeight = function( $element ){ "use strict"; if( $( $element ).length > 0 ){ var $wide = $( '.cl-msn-size-wide', $element ), $height = $( '.cl-msn-size-default', $element ).height() - 20; $wide.css( { height: $height + 'px' } ); $( 'img', $wide ).css( { height: $height + 'px' } ); } } /** * Fix Height of custom Masonry Size * * @since 1.0.0 */ CL_FRONT.fixPortfolioMasonryHeight = function( $element ){ "use strict"; if( $( $element ).length > 0 ){ var $wide = $( '.cl-msn-size-wide', $element), $height = $( '.grid-holder', $wide ).height(), padd = typeof $wide.css('padding') !== 'undefined' ? $wide.css('padding') : '0px', padding = parseInt(padd.replace("px", "")) * 2; $wide.css( { height: $height + padding + 'px' } ); } } CL_FRONT.multiscroll = function(){ var $element = $('.multiscroll'); if( $element.length > 0 ){ CL_FRONT.components.loadDependencies( [ codeless_global.FRONT_LIB_JS + 'multiscroll.js' ], function() { var multi = $element.multiscroll({ navigation: false, normalScrollElements: 'body' }); $element.find( '.slider-navigation .down' ).on('click', function(){ $element.multiscroll.moveSectionDown(); }); $element.find( '.slider-navigation .up' ).on('click', function(){ $element.multiscroll.moveSectionUp(); }); } ); } } CL_FRONT.nanoScroller = function(){ if( $('.scrollbar-div.nano').length == 0 ) return; CL_FRONT.components.loadDependencies( [ codeless_global.FRONT_LIB_JS + 'jquery.nanoscroller.min.js' ], function() { $('.scrollbar-div.nano').nanoScroller({ preventPageScrolling: !1 }); } ); $( document.body ).on( 'wc_fragments_refreshed', function(){ CL_FRONT.nanoScroller(); } ); } CL_FRONT.quickView = function(){ if( CL_FRONT.config.$isMobileScreen ) return; $('.cl-quick-view').on( 'click', function(e){ e.preventDefault(); var $button = $(this); $button.addClass('loading'); var id = $button.data('id'); var data = { id: id, action: "codeless_woo_quick_view" }; CL_FRONT.components.loadDependencies( [ codeless_global.FRONT_LIB_JS + 'jquery.magnific-popup.min.js' ], function() { $.ajax({ url: codeless_global.ajax_url, data: data, method: "get", success: function(message) { var $result = $(message); $result.find( '.woocommerce-product-gallery--with-images').css('opacity', ''); $result.imagesLoaded(function(){ $.magnificPopup.open({ items: { src: '", type: "inline" }, removalDelay: 300, preloader: true, tClose: '', callbacks: { beforeOpen: function() { $.magnificPopup.close(); this.st.mainClass = "mfp-move-horizontal" + " quick-view-wrapper"; }, open: function() { $(".popup-quick-view .variations_form").each(function() { $(this).wc_variation_form().find(".variations select:eq(0)").change() }); $(".popup-quick-view .variations_form").trigger("wc_variation_form"); $( '.popup-quick-view .woocommerce-product-gallery__wrapper' ).addClass('cl-carousel owl-theme owl-carousel'); setTimeout(function(){ CL_FRONT.components.Carousel( $( '.popup-quick-view .woocommerce-product-gallery__wrapper' ), { items: 1, nav: true }, function(){ CL_FRONT.nanoScroller(); } ); }, 1); CL_FRONT.shopDropDown(); CL_FRONT.shopFixes(); CL_FRONT.xBrowserFixes(); if( $('.popup-quick-view').find('.product-type-grouped').length > 0 ) CL_FRONT.quickView(); CL_FRONT.ajaxProductAdd(); $('.popup-quick-view .variation-selector select').on('change', function(){ $(this).closest('.popup-quick-view').find('.woocommerce-product-gallery__wrapper').trigger('to.owl.carousel', 0) }); if( $.fn.tawcvs_variation_swatches_form ) $( '.popup-quick-view .variations_form' ).tawcvs_variation_swatches_form(); $button.removeClass("loading"); } } }) }) }, complete: function() { }, error: function() { $button.removeClass("loading") } } ); }); }); } CL_FRONT.ajaxProductAdd = function(){ // Ajax add to cart on the product page if( typeof wc_cart_fragments_params === 'undefined' ) return; var $warp_fragment_refresh = { url: wc_cart_fragments_params.wc_ajax_url.toString().replace( '%%endpoint%%', 'get_refreshed_fragments' ), type: 'POST', success: function( data ) { if ( data && data.fragments ) { $.each( data.fragments, function( key, value ) { $( key ).replaceWith( value ); }); $( document.body ).trigger( 'wc_fragments_refreshed' ); } } }; $('.entry-summary form.cart').on('submit', function (e) { e.preventDefault(); /*$('.entry-summary').block({ message: null, overlayCSS: { cursor: 'none' } });*/ var product_url = window.location, form = $(this), submitBtn = form.find( 'button[type="submit"]' ); submitBtn.addClass('loading-add-cart'); $.post(product_url, form.serialize() + '&_wp_http_referer=' + product_url, function (result) { var cart_dropdown = $('.widget_shopping_cart', result) // update dropdown cart $('.widget_shopping_cart').replaceWith(cart_dropdown); // update fragments $.ajax($warp_fragment_refresh); /*$('.entry-summary').unblock();*/ submitBtn.removeClass('loading-add-cart'); setTimeout(function(){ submitBtn.addClass('added-cart-success'); submitBtn.html(codeless_global.language.added); }, 100); setTimeout(function(){ submitBtn.removeClass('added-cart-success'); submitBtn.html(codeless_global.language.add_to_cart); }, 2000); }); }); } /** * Post Like Button * * @since 1.0.0 */ CL_FRONT.postLike = function() { "use strict"; $( '.entry-tool-likes .like' ).on( 'click', function( e ) { e.preventDefault(); var $this = $( this ), $id = $this.attr( 'id' ); if ( $this.hasClass( 'item-liked' ) ) return false; if ( $this.hasClass( 'item-inactive' ) ) return false; $.post( codeless_global.ajax_url, { action: 'codeless_post_like', post_id: $id }, function( data ) { $this.find( '.codeless-like-count' ).html( data ); $this.addClass( 'item-liked' ); } ); $this.addClass( 'item-inactive' ); return false; } ); }; CL_FRONT.closedSections = function(){ "use strict"; $('.cl-row.cl-closed-section .close_section_button').on('click', function(e){ e.preventDefault(); var button = $(this); var row = $(this).closest( '.cl-row' ); if( !row.hasClass('opened-section') ){ row.addClass('opened-section'); var height = row.find( '.cl_row-sortable' ).height(); row.find( '.container-content' ).css( 'height', height + 'px' ); }else{ row.find( '.container-content' ).css( 'height', '0px' ); row.removeClass('opened-section'); } }); }; /** * Post Share Count * * @since 1.0.0 */ CL_FRONT.postShareCount = function() { "use strict"; $( '.share-buttons .share' ).on( 'click', function( e ) { var $this = $( this ), $id = $this.attr( 'data-postid' ); $.post( codeless_global.ajax_url, { action: 'codeless_share_counts', post_id: $id }, function( data ) { $this.closest('article').find( '.codeless-share-count' ).html( data ); } ); } ); }; /** * Post Slider Configuration and load * Used only for post slider * * @since 1.0.0 */ CL_FRONT.postSwiper = function( $el ) { "use strict"; var $elements = $el || $( '.cl-post-swiper-slider' ); if ( $elements.length ) { $elements.each( function( i ) { var $element = $( this ); var name = 'swiper.min.js'; if( bowser.msie && bowser.version <= 9 ) name = 'swiper.old.min.js'; CL_FRONT.components.loadDependencies( [ codeless_global.FRONT_LIB_JS + name ], function() { var slider = new Swiper( '.cl-post-swiper-slider', codeless_global.postSwiperOptions ); setTimeout(function(){ if( $element.find('.swiper-slide').length <=1 ) $element.find( '.cl-post-slider-nav' ).css( 'display', 'none' ); }, 50); } ); } ); } }; CL_FRONT.loadAsyncIcons = function(){ CL_FRONT.helpers.loadCSS(codeless_global.FRONT_LIB_CSS + 'codeless-icons.css'); }; /** * Slider Configuration and load * * * @since 1.0.0 */ CL_FRONT.codelessSlider = function( $el ) { "use strict"; var $elements = $el || $( '.cl_slider' ); if ( $elements.length ) { $elements.each( function( i ) { var $element = $( this ); var name = 'swiper.min.js'; if( bowser.msie && bowser.version <= 9 ) name = 'swiper.old.min.js'; CL_FRONT.components.loadDependencies( [ codeless_global.FRONT_LIB_JS + name ], function() { var animateSlide = function( $slide ){ if( $slide.hasClass('cl-slide-animation') && ! $slide.hasClass('animation--none') ) $slide.addClass('start_animation'); }; var opts = { onSlideChangeStart: function(swiper){ $(swiper.slides[swiper.activeIndex]).removeClass('start_animation'); $(swiper.slides[swiper.activeIndex]).find('.start_animation:not(.bg-layer)').removeClass('start_animation'); }, onTransitionStart: function(swiper){ setTimeout(function(){ if( CL_FRONT.config.$header.hasClass('cl-transparent') ){ CL_FRONT.helpers.changeHeaderColor( $(swiper.slides[swiper.activeIndex]) ); setTimeout(function(){ if( ! CL_FRONT.config.$header.hasClass('cl-header-light') ){ $('.cl-slider-nav', $element).removeClass('swiper-button-white'); $('.swiper-pagination', $element).addClass('cl-dark-pagination'); } else{ $('.swiper-pagination', $element).removeClass('cl-dark-pagination'); $('.cl-slider-nav', $element).addClass('swiper-button-white'); } }, 50 ); } animateSlide($(swiper.slides[swiper.activeIndex])); CL_FRONT.animations($(swiper.slides[swiper.activeIndex]), true); }, 300); }, onInit: function(swiper){ if( CL_FRONT.config.$header.hasClass('cl-transparent') ){ if( ! CL_FRONT.config.$header.hasClass('cl-header-light') ){ $('.cl-slider-nav', $element).removeClass('swiper-button-white'); $('.swiper-pagination', $element).addClass('cl-dark-pagination'); } else{ $('.swiper-pagination', $element).removeClass('cl-dark-pagination'); $('.cl-slider-nav', $element).addClass('swiper-button-white'); } } $element.addClass('loading-on-end'); setTimeout(function(){ $element.addClass('loading-end'); }, 400); setTimeout(function(){ animateSlide($(swiper.slides[swiper.activeIndex])); CL_FRONT.animations($(swiper.slides[swiper.activeIndex]), true); }, 500); }, parallax: true, speed: parseInt(CL_FRONT.helpers.parseData( $element.data('speed'), 300 )), direction: CL_FRONT.helpers.parseData( $element.data('direction'), 'horizontal' ), autoplay: parseInt(CL_FRONT.helpers.parseData( $element.data('autoplay'), 6500 )), loop: parseInt( CL_FRONT.helpers.parseData( $element.data('loop'), false ) ), mousewheelControl: parseInt( CL_FRONT.helpers.parseData( $element.data('mousewheel'), false ) ), }; var cl_effect = { effect: CL_FRONT.helpers.parseData( $element.data('effect'), 'fade' ) }; if( CL_FRONT.helpers.parseData( $element.data('effect'), 'fade' ) == 'interleave' && CL_FRONT.config.$windowWidth > 992 ){ var interleaveOffset = -.5; if( CL_FRONT.helpers.parseData( $element.data('direction'), 'horizontal' ) == 'horizontal' ){ cl_effect = { onProgress: function(swiper, progress){ for (var i = 0; i < swiper.slides.length; i++){ var slide = swiper.slides[i]; var translate, innerTranslate; progress = slide.progress; if (progress > 0) { translate = progress * swiper.width; innerTranslate = translate * interleaveOffset; } else { innerTranslate = Math.abs( progress * swiper.width ) * interleaveOffset; translate = 0; } $(slide).css({ transform: 'translate3d(' + translate + 'px,0,0)' }); $(slide).find('.cl-row > .bg-layer').css({ transform: 'translate3d(' + innerTranslate + 'px,0,0)' }); } }, onTouchStart: function(swiper){ for (var i = 0; i < swiper.slides.length; i++){ $(swiper.slides[i]).css({ transition: '' }); } }, onSetTransition: function(swiper, speed) { for (var i = 0; i < swiper.slides.length; i++){ $(swiper.slides[i]) .find('.cl-row > .bg-layer') .andSelf() .css({ transition: speed + 'ms' }); } } }; }else{ cl_effect = { onProgress: function(swiper, progress){ for (var i = 0; i < swiper.slides.length; i++){ var slide = swiper.slides[i]; var translate, innerTranslate; progress = slide.progress; if (progress > 0) { translate = progress * swiper.height; innerTranslate = translate * interleaveOffset; } else { innerTranslate = Math.abs( progress * swiper.height ) * interleaveOffset; translate = 0; } $(slide).css({ transform: 'translate3d(0,' + translate + 'px, 0)' }); $(slide).find('.cl-row').css({ transform: 'translate3d(0,' + innerTranslate + 'px, 0)' }); } }, onTouchStart: function(swiper){ for (var i = 0; i < swiper.slides.length; i++){ $(swiper.slides[i]).css({ transition: '' }); } }, onSetTransition: function(swiper, speed) { for (var i = 0; i < swiper.slides.length; i++){ $(swiper.slides[i]) .find('.cl-row') .andSelf() .css({ transition: speed + 'ms' }); } } }; } } if( CL_FRONT.helpers.parseData( $element.data('effect'), 'fade' ) == 'softscale'){ cl_effect = { onSetTranslate: function () { }, onSetTransition: function (duration) { s.slides.transition(duration); if (s.params.virtualTranslate && duration !== 0) { var eventTriggered = false; s.slides.transitionEnd(function () { if (eventTriggered) return; if (!s) return; eventTriggered = true; s.animating = false; var triggerEvents = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd']; for (var i = 0; i < triggerEvents.length; i++) { s.wrapper.trigger(triggerEvents[i]); } }); } }, onSlideChangeStart: function(swiper){ var active = swiper.activeIndex, prev = swiper.previousIndex; if( ! $( swiper.slides[prev] ).find('.cl-row').hasClass('navOutNext') ) $( swiper.slides[prev] ).find('.cl-row').addClass('navOutNext'); if( $( swiper.slides[active] ).find('.cl-row').hasClass('navInNext') ) $( swiper.slides[active] ).find('.cl-row').removeClass('navInNext'); $( swiper.slides[active] ).find('.cl-row').addClass('navInNext'); setTimeout(function(){ $( swiper.slides[prev] ).find('.cl-row').removeClass('navOutNext'); $( swiper.slides[active] ).find('.cl-row').removeClass('navInNext'); }, 1500); }, effect: 'softscale', virtualTranslate: true, slidesPerView : 1, slidesPerColumn : 1, slidesPerGroup : 1, watchSlidesProgress : true, spaceBetween : 0 }; } opts = $.extend(opts, cl_effect); if( parseInt(CL_FRONT.helpers.parseData( $element.data('pagination'), 1 ) ) ){ opts['pagination'] = '.swiper-pagination'; opts['paginationClickable'] = true; } if( parseInt(CL_FRONT.helpers.parseData( $element.data('navigation'), 1 ) ) ){ opts['nextButton'] = '.swiper-button-next'; opts['prevButton'] = '.swiper-button-prev'; } if( parseInt(CL_FRONT.helpers.parseData( $element.data('anchors'), 0 ) ) ){ opts['paginationBulletRender'] = function (swiper, index, className) { var anchor = $(swiper.slides[index]).find('[data-anchor]').data('anchor'); return ''; } } if( $element.hasClass('cl_slider-centered_carousel') && CL_FRONT.config.$windowWidth >= 992 ){ opts['slidesPerView'] = 'auto'; opts['centeredSlides'] = true; opts['spaceBetween'] = 30; opts['initialSlide'] = 1; opts['effect'] = 'slide'; } var actualInstance = new Swiper( '.cl_slider', opts ); CL_FRONT.config.$initSliders[$element.attr('id')] = actualInstance; var animateOnScroll = function(){ var startPoint = $element.offset().top + ( $element.height() * 0.44 ); if( CL_FRONT.config.$windowTop >= startPoint && ! $element.hasClass('cl-animateScroll') ) $element.addClass('cl-animateScroll'); else if( $element.hasClass('cl-animateScroll') && CL_FRONT.config.$windowTop < startPoint) $element.removeClass('cl-animateScroll') }; setTimeout(function(){ $(window).on('scroll', function(){ if( CL_FRONT.helpers.parseData( $element.data('direction'), 'horizontal' ) == 'vertical' && CL_FRONT.config.$windowWidth < 992 ) return; animateOnScroll(); }); }, 100); var destroyed = false; var verticalSliderResponsive = function(){ if( CL_FRONT.helpers.parseData( $element.data('direction'), 'horizontal' ) != 'vertical' || ! $element.hasClass('cl_slider-responsive-plain') ) return; if( CL_FRONT.config.$windowWidth > 992 ){ if( destroyed ){ actualInstance = new Swiper( '.cl_slider', opts ); CL_FRONT.config.$initSliders[$element.attr('id')] = actualInstance; } return; } if( ! destroyed ){ actualInstance.destroy(false); destroyed = true; CL_FRONT.animations($element, true); } } var carouselSliderResponsive = function(){ if( $element.hasClass('cl_slider-centered_carousel') ){ actualInstance = new Swiper( '.cl_slider', opts ); CL_FRONT.config.$initSliders[$element.attr('id')] = actualInstance; } } verticalSliderResponsive(); $(window).resize(function(){ verticalSliderResponsive(); carouselSliderResponsive(); }) } ); } ); } }; CL_FRONT.headerSearch = function(){ if( $( '.search-element', '.header_container' ).length > 0 ){ if( CL_FRONT.config.$windowWidth >= 567 ){ if( $('.search-element', '.header_container').hasClass('expand-responsive') ) $('.search-element', '.header_container').removeClass('expand-responsive'); }else{ $('.search-element', '.header_container').each(function(){ var $element = $(this); $element.on( 'click', function(e){ e.preventDefault(); if( ! $element.hasClass( 'expand-responsive' ) ){ $element.addClass('expand-responsive'); $(document).on('click', funcBody1); } } ); }); var funcBody1 = function(e){ if( !$(e.target).is('.search-element') && $(e.target).closest( '.search-element' ).length == 0 ){ if( $('.search-element').hasClass( 'expand-responsive' ) ){ $('.search-element').removeClass('expand-responsive'); $(document).off('click', funcBody1); } } } } } if( $( '.search.tool', '.header_container' ).length > 0 ){ $( '.search.tool', '.header_container' ).each(function(){ var $element = $(this); var $link = $element.find('.tool-link'); $link.on( 'click', function(e){ e.preventDefault(); if( ! $element.hasClass( 'expand' ) ){ $element.addClass('expand'); $(document).on('click', funcBody2); } } ); }); var funcBody2 = function(e){ if( !$(e.target).is('.search.tool') && $(e.target).closest( '.search.tool' ).length == 0 ){ if( $('.search.tool').hasClass( 'expand' ) ){ $('.search.tool').removeClass('expand'); $(document).off('click', funcBody2); } } } } } /** * Load More Button and Infinite Scroll * * @since 1.0.0 */ CL_FRONT.paginationInfinite = function( $el ) { "use strict"; var $elements = $el || $( '.cl-pagination-infinite' ); if ( $elements.length ) { $elements.each( function( i ) { var $element = $( this ); CL_FRONT.components.loadDependencies( [ codeless_global.FRONT_LIB_JS + 'infinitescroll.js' ], function() { var $container = $( '.' + $element.parent().data( 'containerId' ) ); // Init infinite scroll $container.infinitescroll( { loading: { msg: null, finishedMsg: '', msgText: '', start: function(){ var inf = $(this).data('infinitescroll'); var opts = inf.options; $('.cl-infinite-loader').removeClass('hidden'); $(opts.navSelector).hide(); opts.loading.msg .appendTo(opts.loading.selector) .show(opts.loading.speed, $.proxy(function() { inf.beginAjax(opts); })); }, finished: function(){ $('.cl-infinite-loader').addClass('hidden'); } }, navSelector: 'div.cl-pagination-infinite .older-posts', nextSelector: 'div.cl-pagination-infinite .older-posts a', itemSelector: 'article.post, .portfolio_item, .product_item', errorCallback: function() { $( '#cl_load_more_btn' ).animate( { opacity: 0 } ).remove(); $('.cl-infinite-loader').addClass('hidden'); }, }, // Callback function function( newElements ) { $( '#infscr-loading', $container ).remove(); var $newElems = $( newElements ); if ( !$container.hasClass( 'animated-entries' ) ) $newElems.css( 'opacity', 0 ); $newElems.imagesLoaded( function() { // Animate new Items if ( !$container.hasClass( 'animated-entries' ) ){ $newElems.animate( { opacity: 1 } ); } CL_FRONT.postInit( $newElems ); CL_FRONT.fixPostVideoHeight( $newElems ); // Appended to Isotope if ( $container.hasClass( 'grid-entries' ) || $container.hasClass( 'masonry-entries' ) ) { var iso = $container.data( 'isotope' ); if( $.fn.tawcvs_variation_swatches_form ){ $( '.variations_form', $newElems ).tawcvs_variation_swatches_form(); setTimeout(function(){ CL_FRONT.shopColorChange($( '.variations_form', $newElems )); }, 10); } iso.appended( $newElems ); iso.layout(); CL_FRONT.quickView(); } // Run Animation if ( $container.hasClass( 'animated-entries' ) ) CL_FRONT.animations(); if ( $element.data( 'type' ) == 'loadmore' ) $( 'body, html' ).animate( { scrollTop: $newElems.offset().top }, 800 ); } ); } ); // If loadmore button is active if ( $element.data( 'type' ) == 'loadmore' ) { $( window ).unbind( '.infscr' ); $( '#cl_load_more_btn' ).on( 'click', function() { $container.infinitescroll( 'retrieve' ); } ); } } ); } ); } }; /** * Blog Grid and Masonry Isotope * Use the Isotope component * * @since 1.0.0 */ CL_FRONT.isotopeBlogGrid = CL_FRONT.init_cl_blog = function( $el ) { "use strict"; $( '.blog-entries' ).each(function(){ if( $(this).hasClass('cl-carousel') ){ var $data = { responsive: { 0: { items: 1, stagePadding : 0 }, 480: { items: 1, stagePadding : 0 }, 768: { items: 2, stagePadding : 0 }, 992: { items: CL_FRONT.helpers.parseData( parseInt( $( this ).attr('data-carousel-layout') ), 3 ) } }, items: CL_FRONT.helpers.parseData( parseInt( $( this ).attr('data-carousel-layout') ), 3 ), slideBy: 1, smartSpeed: 600, }; if( $( this ).attr('data-carousel-effect') == 'fade' ){ $data.animateIn = 'fadeIn'; $data.animateOut = 'fadeOut'; } if( CL_FRONT.helpers.parseData( parseInt( $(this).attr('data-carousel-stagepadding') ), 0 ) === 1 ){ $data.stagePadding = 150; $data.loop = true; } CL_FRONT.components.Carousel( $( this ), $data, function(owl, el){ CL_FRONT.fixPostVideoHeight(el.find('article.format-video')); CL_FRONT.postSwiper(el); owl.on('resized.owl.carousel', function(event){ CL_FRONT.animations( el.find( '.owl-item.active' ), true ); }); }); }else if( $(this).hasClass('masonry-entries') || $(this).hasClass('grid-entries') ){ CL_FRONT.components.Isotope( $( this ) ); var $blog_entries = $(this); var $blog = $(this).closest('.cl_blog'); var $blog_grid_filters = $blog.find('.blog-filters > .grid-options a'); var $blog_sort_filters = $blog.find('.blog-filters #blog_sort_by'); if( $blog_sort_filters.length > 0 ) $blog_sort_filters.on( 'change', function(e){ e.preventDefault(); var value = $(this).val(); var url = $blog_sort_filters.attr('data-url'); window.location = url+'&blog_sort_by='+value; } ); if( $blog_grid_filters.length > 0 ) $blog_grid_filters.on( 'click', function(e){ e.preventDefault(); $(this); $blog_grid_filters.removeClass('active'); $(this).addClass('active'); $blog.find('.blog-entries').attr('data-grid-cols', $(this).attr( 'data-grid-cols' )); CL_FRONT.components.Isotope( $blog_entries ); } ); } }); }; /** * Isotope Portfolio Init * used on Customizer too * * @since 1.0.0 */ CL_FRONT.isotopePortfolioGrid = CL_FRONT.init_cl_portfolio = function( $el ) { "use strict"; $( '#portfolio-entries' ).each(function(){ if( $(this).hasClass('cl-carousel') ) CL_FRONT.components.Carousel( $( this ) ); else if( $(this).hasClass('cl-justify-gallery') ) CL_FRONT.components.JustifyGallery( $( this ) ); else CL_FRONT.components.Isotope( $( this ) ); }) }; /** * Init Testimonial Carousel * * @since 1.0.0 */ CL_FRONT.testimonialCarousel = CL_FRONT.init_cl_testimonial = function(){ "use strict"; $('.testimonial-entries.cl-carousel').each(function(){ CL_FRONT.components.Carousel( $( this ), { items: 1, animateIn: 'alpha-in', animateOut: 'fadeOut', }); }); } /** * Team Carousel * * @since 1.0.0 */ CL_FRONT.teamCarousel = CL_FRONT.init_cl_team = function(){ "use strict"; $('.cl_team.cl-carousel').each(function(){ CL_FRONT.components.Carousel( $( this ), { responsive: { 0: { items: 1 }, 480: { items: 2 }, 768: { items: 3 }, 992: { items: CL_FRONT.helpers.parseData( $(this).data('columns'), 4 ) } }, animateIn: 'alpha-in', animateOut: 'fadeOut', center: CL_FRONT.helpers.parseData( $(this).data('center'), false ), loop: CL_FRONT.helpers.parseData( $(this).data('center'), false ), }); }); } /** * Clients Carousel * * @since 1.0.0 */ CL_FRONT.clientsCarousel = CL_FRONT.init_cl_clients = function(){ "use strict"; $('.cl_clients.cl-carousel').each(function(){ CL_FRONT.components.Carousel( $( this ), { responsive: { 0: { items: 2 }, 480: { items: 2 }, 768: { items: 3 }, 992: { items: CL_FRONT.helpers.parseData( $(this).data('items'), 6 ) } }, items: CL_FRONT.helpers.parseData( $(this).data('items'), 6 ), animateIn: 'alpha-in', animateOut: 'fadeOut', autoplay: true, autoplayTimeout: CL_FRONT.helpers.parseData( $(this).data('autoplayTimeout'), 5000 ), loop: false }); }); }; /** * Gallery Carousel * * @since 1.0.0 */ CL_FRONT.galleryCarousel = CL_FRONT.init_cl_gallery = function(){ "use strict"; $('.cl_gallery.cl-carousel').each(function(){ CL_FRONT.components.Carousel( $( this ), { responsive: { 0: { items: 1 }, 480: { items: 2 }, 768: { items: 3 }, 992: { items: CL_FRONT.helpers.parseData( $(this).data('items'), 2 ) } }, items: CL_FRONT.helpers.parseData( $(this).data('items'), 2 ), animateIn: 'alpha-in', animateOut: 'fadeOut', }); }); } /** * Insta Feed * * @since 1.0.0 */ CL_FRONT.instaFeed = function(){ "use strict"; $('.cl-instafeed.cl-carousel').each(function(){ var $instafeed = $(this); CL_FRONT.components.loadDependencies( [ codeless_global.FRONT_LIB_JS + 'instafeed.min.js' ], function() { var $token = $instafeed.data('token'), $userid = $instafeed.data('userid'); var userFeed = new Instafeed({ get: 'user', userId: $userid, accessToken: $token, target: $instafeed[0], template: '', resolution: 'low_resolution', after: function() { var $data = { responsive: { 0: { items: 1 }, 480: { items: 2 }, 768: { items: 3 }, 992: { items: 6 } }, items: 6, slideBy: 1, smartSpeed: 600, center: true, loop:true, margin:10, }; CL_FRONT.components.Carousel( $instafeed, $data, function(owl, el){ owl.on('resized.owl.carousel', function(event){ CL_FRONT.animations( el.find( '.owl-item.active' ), true ); }); }); } }); userFeed.run(); }); }); $('.widget .cl-instafeed').each(function(){ var $instafeed = $(this); CL_FRONT.components.loadDependencies( [ codeless_global.FRONT_LIB_JS + 'instafeed.min.js' ], function() { var $token = $instafeed.data('token'), $userid = $instafeed.data('userid'); var userFeed = new Instafeed({ get: 'user', userId: $userid, accessToken: $token, limit: 4, target: $instafeed[0], template: '', resolution: 'low_resolution', }); userFeed.run(); }); }); }; /** * Codeless Toggles * * @since 1.0.0 */ CL_FRONT.codelessToggles = CL_FRONT.init_cl_toggles = function(){ "use strict"; $('.cl_toggles').each(function(){ var $toggles = $(this); CL_FRONT.components.loadDependencies( [ codeless_global.FRONT_LIB_JS + 'jquery.collapse.js' ], function() { $toggles.collapse({ open: function() { // The context of 'this' is applied to // the collapsed details in a jQuery wrapper this.slideDown(200); }, close: function() { this.slideUp(200); }, accordion: CL_FRONT.helpers.parseData( $toggles.attr('data-accordion'), false ), query: '.cl_toggle .title' }); }); }); }; /** * Active Tabs * * @since 1.0.0 */ CL_FRONT.codelessTabs = CL_FRONT.init_cl_tabs = function(){ $('.cl_tabs').each(function(){ var $tabs = $(this); CL_FRONT.components.loadDependencies( [ codeless_global.FRONT_LIB_JS + 'bootstrap-tabs.min.js' ], function() { $tabs.find('.tab-content > .tab-pane').first().addClass('active in'); $tabs.find('.tab-content .cl_cl_tab').first().addClass('activeBuilder'); $('.cl-nav-tabs li:first-child', $tabs).addClass('active'); // Builder $tabs.find('.tab-content .cl_element').first().find('.tab-pane').addClass('active in'); $('.cl-nav-tabs a', $tabs).on( 'click', function(e){ if( !CL_FRONT.config.$isCustomizer ) e.preventDefault() $(this).tab('show'); }); }); }); }; /** * Fix Height of Video Post when loaded with ajax * * @since 1.0.0 */ CL_FRONT.fixPostVideoHeight = function( $el ) { var $elements = CL_FRONT.helpers.parseData( $el, $( 'article.format-video' ) ); if ( $elements.length ) { $elements.each( function( i ) { var $element = $( this ); if ( !$element.hasClass( 'format-video' ) ) return; if( $element.hasClass('alternate-style') ) return; var width = $element.find( 'video, iframe' ).attr( 'width' ), height = $element.find( 'video, iframe' ).attr( 'height' ), element_width = $element.width(); var new_height = ( element_width * height ) / width; $element.find( 'video, iframe' ).height( new_height + 'px' ); } ); } } /** * Sticky Sidebar Function * * @since 1.0.0 */ CL_FRONT.stickySidebar = function() { "use strict"; if ( this.config.$aside.hasClass( 'cl-sticky' ) && !this.config.$isMobileScreen ) { if ( this.config.$asideHeight == 0 ) this.config.$asideHeight = this.config.$aside.height(); if ( this.config.$asideTop == 0 ) this.config.$asideTop = this.config.$aside.offset().top; if ( this.config.$asideStickyOffset == 0 ) this.config.$asideStickyOffset = this.config.$aside.data( 'stickyOffset' ) != 0 ? this.config.$aside.find( '.widget:nth-last-child(' + parseInt( this.config.$aside.data( 'stickyOffset' ) ) + ')' ).offset().top : 0; var cl_distace = 80, cl_point = 0; if ( this.config.$asideStickyOffset != 0 ) cl_point = this.config.$asideStickyOffset; else cl_point = this.config.$asideTop - cl_distace; this.config.$aside.find( '.cl-sticky-wrapper' ).width( this.config.$aside.width() + 'px' ); if ( this.config.$windowTop >= cl_point ) { this.config.$aside.addClass( 'cl-sticky-active' ); this.config.$aside.find( '.cl-sticky-wrapper' ).css( 'top', '-' + ( cl_point - this.config.$asideTop ) + 'px' ); } else { this.config.$aside.find( '.cl-sticky-wrapper' ).css( 'top', cl_distace + 'px' ); this.config.$aside.removeClass( 'cl-sticky-active' ); } } } /** * Sticky Column Function * * @since 1.0.0 * */ CL_FRONT.stickyColumn = function() { "use strict"; if(!this.config.$isMobileScreen && $('.cl-sticky.cl_column').length > 0){ $('.cl-sticky.cl_column').each( function(){ var $sticky = $(this), stickyTop = 0, stickyHeight = 0; stickyHeight = $sticky.height(); stickyTop = $sticky.offset().top; var cl_distace = 0, cl_point = 0; cl_point = stickyTop - cl_distace; $sticky.find( '.cl_col_wrapper ' ).width( $sticky.width() + 'px' ); if ( CL_FRONT.config.$windowTop >= cl_point ) { $sticky.addClass( 'cl-sticky-active' ); $sticky.find( '.cl_col_wrapper' ).css( 'top', '-' + ( cl_point - stickyTop ) + 'px' ); } else { $sticky.find( '.cl_col_wrapper' ).css( 'top', cl_distace + 'px' ); $sticky.removeClass( 'cl-sticky-active' ); } }); } } /** * Progress Bar Function * * @since 1.0.0 * */ CL_FRONT.progressBar = function($el){ "use strict"; var from_start = $el == null ? true : false; var $elements = CL_FRONT.helpers.parseData( $el, $( '.cl_progress_bar' ) ); if( $elements.length > 0 ){ $elements.each(function(){ var $element = $(this), percentage = $element.attr('data-percentage'); if( from_start && $element.hasClass('animate_on_visible') ) return; $element.find('.percentage').html(percentage+'%'); $element.find('.bar').css('width', percentage+'%'); }); } }; CL_FRONT.mediaElement = CL_FRONT.init_cl_media = function(){ "use strict"; if( $('.cl_media.type-video').length > 0 ){ $('.cl_media.type-video').each(function(){ var $element = $(this), $play = $element.find( '.play-button' ), $isPlay = ($play.length > 0) ? true : false; if( $isPlay ){ $element.addClass('hide-video'); setTimeout(function(){ var height = $element.find( 'iframe, video' ).height(); $element.height(height); }, 50); $play.on('click', function(e){ e.preventDefault(); $element.find( 'source, iframe' ).each(function(){ var src = $(this).attr('data-src'); $(this).attr('src', src); }); setTimeout(function(){ $element.addClass('show-video'); }, 100); }); }else{ $element.find( 'source, iframe' ).each(function(){ var src = $(this).attr('data-src'); $(this).attr('src', src); }); } }); } }; /** * Init Page Header Element * Used on Codeless Builder Too * @since 1.0.0 */ CL_FRONT.init_cl_page_header = function(){ this.fixPageHeaderCenter(); CL_FRONT.components.loadAnimation( $( '.cl_page_header' ), function(){ CL_FRONT.pageHeaderParallax(); } ); }; /** * Page Header Parallax * Loads the Parallax component * @since 1.0.0 */ CL_FRONT.pageHeaderParallax = function() { "use strict"; if ( $( '.cl_page_header.cl-parallax .bg-layer' ).length > 0 ) CL_FRONT.components.Parallax( $( '.cl_page_header.cl-parallax .bg-layer' ) ).init(); }; CL_FRONT.fixPageHeaderCenter = function(){ if( this.config.$header.hasClass('cl-transparent') && $( '.cl_page_header' ).length > 0 ){ var $pageHeader = $( '.cl_page_header' ); if( $pageHeader.hasClass('modern') ) $pageHeader.css( { paddingTop: (this.config.$headerHeight / 2) + 'px' } ); } } /** * Fix Megamenu Position when is out from container * @since 1.0.0 */ CL_FRONT.fixMegaMenuPosition = function( menu ){ "use strict"; var fixMegaMenu = function(megamenu){ var width = $( megamenu ).find('> .sub-menu').width(), liParent = $( megamenu ).parent( 'li' ), mega_columns = $( megamenu ).children('ul').children('li'), columns = mega_columns.length, column_width = width / columns, mega_menu_layout = $( megamenu ).hasClass('layout-boxed') ? 'boxed' : 'fullwidth', bg_image = liParent.data('bg'), bg_type = $( megamenu ).hasClass('bg_type-background') ? 'background' : 'column', offsetFromLi = liParent.offset().left - CL_FRONT.config.$containerOffsetLeft; if( mega_menu_layout == 'boxed' ){ width = $( megamenu ).width() - 40; column_width = width / columns; if( width == CL_FRONT.config.$containerWidth ) $( megamenu ).css( { left: '-' + offsetFromLi + 'px' } ); else { setTimeout(function(){ var offsetOutFromContainer = Math.abs( (CL_FRONT.config.$containerOffsetLeft + CL_FRONT.config.$containerWidth) - ( liParent.offset().left + width ) ); if( offsetOutFromContainer > offsetFromLi ) offsetOutFromContainer = 0; $( megamenu ).css( { left: '-' + (offsetOutFromContainer + 20) + 'px' } ); }, 1); } }else{ $( megamenu ).css( { left: '-' + liParent.offset().left + 'px', width: CL_FRONT.config.$windowWidth + 'px'} ); $( megamenu ).find('> .sub-menu').css({width:'1170px', margin: '0 auto'}); } if( bg_image != '' && bg_type == 'background' ){ $( megamenu ).css({"background-image": 'url("'+bg_image+'")'}); } mega_columns.css( { width: column_width + 'px'} ); }; if( ! menu ){ this.config.$navigation.find( '.codeless_custom_menu_mega_menu' ).each( function( index, megamenu ){ fixMegaMenu( megamenu ); } ); }else{ fixMegaMenu( menu ); } }; /** * Initialize Tools Dropdown in Responsive * * @since 1.0.0 */ CL_FRONT.initToolsResponsive = function() { "use strict"; var self = this; if( this.config.$windowWidth <= 991 ){ if( this.config.$headerToolsInit ) return; this.config.$headerTools.find( '.tool .cl-submenu' ).each(function(){ var submenu = $(this); submenu.addClass('cl-hide-on-mobile'); var responsiveMenu = submenu.clone().appendTo(CL_FRONT.config.$header); responsiveMenu.removeClass( 'cl-hide-on-mobile' ).addClass( 'cl-mobile-menu' ); CL_FRONT.config.$headerToolsList.push(submenu); submenu.closest('.tool').find(' > i, > .tool-link').on( 'click', function( e ){ e.preventDefault(); var button = $(this); responsiveMenu.slideToggle('200'); } ); }); this.config.$headerToolsInit = true; }else{ this.config.$header.find('.cl-mobile-menu').addClass('cl-hide-not-mobile'); if( CL_FRONT.config.$headerToolsList.length > 0 ){ CL_FRONT.config.$headerToolsList.forEach( function(menu){ menu.closest('.tool').find(' > i, > .tool-link').off('click'); menu.closest('.tool').find(' > i, > .tool-link').on('click', function(e){ return true; }); } ); } } } CL_FRONT.scrollToTopButton = function(){ "use strict"; $(window).scroll(function(){ if ($(this).scrollTop() > 100) { $('.scrollToTop').fadeIn(); } else { $('.scrollToTop').fadeOut(); } }); //Click event to scroll to top $('.scrollToTop').click(function(){ $('html, body').animate({scrollTop : 0},800); return false; }); } /** * Tools Dropdown init * @since 1.0.0 */ CL_FRONT.initToolsDropdown = function() { "use strict"; var toOpen = null, isOpen = false, mainNode = null; this.config.$headerTools.find( '.tool' ).each( function( index, submenu ) { if ( $( submenu ).find( '.cl-submenu' ).length > 0 ) { $( submenu ).addClass( 'hasSubMenu' ); } } ); mainNode = this.config.$headerTools; this.config.$headerTools.mouseover( function( e ) { var item = e.target || e.srcElement; while ( ! $(item).hasClass('tool') && ! $(item).hasClass('extra_tools_wrapper') ) { if( item != null ) item = item.parentNode; } if ( $(item).hasClass('tool') ) { toOpen = item; open(); } } ).mouseleave( function(e) { close(); } ); var open = function() { isOpen = true; // Get other items with same parent var items = $( toOpen ).parent().children( '.tool' ); $( items ).each( function( index, item ) { $( item ).find( ".cl-submenu" ).each( function( index, submenu ) { if ( item != toOpen ) { $( item ).removeClass( "showDropdown" ); close( item ); } else if ( !$( item ).hasClass( 'showDropdown' ) ) { $( item ).addClass( "showDropdown" ); var left = 0; var node = submenu; while ( node ) { left += Math.abs( node.offsetLeft ); node = node.offsetParent; } var right = left + submenu.offsetWidth; //We should refactor this code to execute only when menu is vertical var menuHeight = $( submenu ).outerHeight(); var parentTop = $( submenu ).offset().top - $( window ).scrollTop(); var totalHeight = menuHeight + parentTop; var windowHeight = window.innerHeight; $( item ).removeClass( 'dropdownRightToLeft' ); if ( left < 0 ) $( item ).addClass( 'dropdownLeftToRight' ); if ( right > CL_FRONT.config.$containerOffsetLeft + CL_FRONT.config.$containerWidth ) { $( item ).addClass( 'dropdownRightToLeft' ); } if( $( item ).parents( '.showDropdown' ).length > 0 ){ var width = $( item ).parents( '.showDropdown' ).first().children('.cl-submenu').width(); if( $( item ).hasClass( 'dropdownLeftToRight' ) || ( ! $( item ).hasClass( 'dropdownLeftToRight' ) && ! $( item ).hasClass( 'dropdownRightToLeft' ) ) ){ if( !$('body').hasClass('rtl') ) $( item ).find( ".cl-submenu" ).css( { left: (width+16)+'px' } ); else $( item ).find( ".cl-submenu" ).css( { right: (width+16)+'px' } ); } if( $( item ).hasClass( 'dropdownRightToLeft' ) ) $( item ).find( "cl-submenu" ).css( { right: (width+16)+'px' } ); } } } ); } ); }; var close = function( node ) { if (!node) { isOpen = false; node = mainNode; } // loop over the items, closing their submenus $(node).find('.tool').each(function(index, item) { $(item).removeClass('showDropdown'); }); } }; /** * Menu Dropdown init * @since 1.0.0 */ CL_FRONT.initMenuDropdown = function() { "use strict"; var toOpen = null, isOpen = false, mainNode = null, subHeights = []; this.config.$navigation.find( 'ul > li' ).each( function( index, submenu ) { if ( $( submenu ).find( 'ul' ).length > 0 ) { $( submenu ).addClass( 'hasSubMenu' ); if( $( submenu ).parents('.cl-dropdown-inline').length > 0 ){ //$( submenu ).find('ul').slideUp(); } } } ); mainNode = this.config.$navigation[0]; this.config.$navigation.mouseover( function( e ) { var item = e.target || e.srcElement; if( typeof item === 'undefined' || !item ) return; while ( item.nodeName != 'LI' && item != mainNode ) { item = item.parentNode; } if ( item.nodeName == 'LI' ) { toOpen = item; open(); } } ).mouseleave( function() { close(); } ); var open = function() { isOpen = true; // Get other items with same parent var items = $( toOpen ).parent().children( 'li' ); $( items ).each( function( index, item ) { $( item ).find( "ul" ).each( function( index, submenu ) { if ( item != toOpen ) { if( $( item ).parents('.cl-dropdown-inline').length > 0 ){ $( submenu ).animate( {height: '0px' }, 20); } $( item ).removeClass( "showDropdown" ); close( item ); } else if ( !$( item ).hasClass( 'showDropdown' ) ) { if( $( item ).children( '.codeless_custom_menu_mega_menu' ).length > 0 ){ CL_FRONT.fixMegaMenuPosition( $( item ).children( '.codeless_custom_menu_mega_menu' )[0] ); } $( item ).addClass( "showDropdown" ); var left = 0; var node = submenu; while ( node ) { left += Math.abs( node.offsetLeft ); node = node.offsetParent; } var right = left + submenu.offsetWidth; var menuHeight = $( submenu ).outerHeight(); var innerHeight = $( submenu ).innerHeight(); var parentTop = $( submenu ).offset().top - $( window ).scrollTop(); var totalHeight = menuHeight + parentTop; var windowHeight = window.innerHeight; /* Vetical Inline submenu */ if( $( item ).parents('.cl-dropdown-inline').length > 0 ){ $( submenu ).css('display', 'none').css('height', 'auto'); var h = $( submenu ).outerHeight(); $( submenu ).css('height', 0).css('display', 'block'); $( submenu ).animate( {height: h + 'px' }, 100); } $( item ).removeClass( 'dropdownRightToLeft' ); if ( left < 0 ) $( item ).addClass( 'dropdownLeftToRight' ); if ( right > document.body.clientWidth ) { $( item ).addClass( 'dropdownRightToLeft' ); } if( $( item ).parents( '.showDropdown' ).length > 0 && $( item ).parents( '.codeless_custom_menu_mega_menu' ).length == 0 ){ var width = $( item ).parents( '.showDropdown' ).first().children('ul').width(); if( $( item ).hasClass( 'dropdownLeftToRight' ) || ( ! $( item ).hasClass( 'dropdownLeftToRight' ) && ! $( item ).hasClass( 'dropdownRightToLeft' ) ) ){ if( !$('body').hasClass('rtl') ) $( item ).find( "ul" ).css( { left: (width+16)+'px' } ); else{ $( item ).find( "ul" ).css( { right: (width+16)+'px' } ); } } if( $( item ).hasClass( 'dropdownRightToLeft' ) ) $( item ).find( "ul" ).css( { right: (width+16)+'px' } ); } } } ); } ); }; var close = function( node ) { if (!node) { isOpen = false; node = CL_FRONT.config.$navigation; } // loop over the items, closing their submenus $(node).find('li').each(function(index, item) { if( $( item ).parents('.cl-dropdown-inline').length > 0 ) $(item).find('.sub-menu').css('height', 0); $(item).removeClass('showDropdown'); }); } } /** * Initialize Lightbox Elements * @since 1.0.0 */ CL_FRONT.itemILightBox = function(){ "use strict"; var el = $( '.entry-lightbox, .portfolio_item .entry-link.lightbox, .cl_media .lightbox' ); if( el.length > 0 ){ CL_FRONT.components.LightBox( el ); } } /** * Convert SVG to Animated Items * @since 1.0.0 */ CL_FRONT.convertSVGAnimated = function(){ "use strict"; if( $('svg.animated').length > 0 && ! CL_FRONT.config.$isCustomizer ){ CL_FRONT.components.loadDependencies( [ codeless_global.FRONT_LIB_JS + 'svg4everybody.js' ], function() { svg4everybody({polyfill: true}); var id = 0; $('svg').each(function(index, item){ if( $(item).hasClass('animated') ){ CL_FRONT.components.loadDependencies( [ codeless_global.FRONT_LIB_JS + 'vivus.min.js' ], function() { id = 'svg_animated_' + index; $(item).attr('id', id); new Vivus( id, {duration: 200} ); }); } }); }); } } /** * Initialize Google Map * @since 1.0.0 */ CL_FRONT.codelessGMap = CL_FRONT.init_cl_map = function(){ "use strict"; if( $('.cl_map').length > 0 ){ $('.cl_map').each(function(){ var $el = $(this); var map = $el.find('.cl-map-element').first()[0]; var data = {}; data.style = CL_FRONT.helpers.parseData( $el.attr('data-style'), '' ), data.latitude = $el.attr('data-lat'), data.longitude = $el.attr('data-lon'), data.map_zoom = CL_FRONT.helpers.parseData( $el.attr('data-zoom'), '4' ); CL_FRONT.components.loadDependencies( [ codeless_global.FRONT_LIB_JS + 'codeless-gmaps.js' ], function() { CL_FRONT.codelessInitMap( map, data ); }); }); } } /** * Contact Form Submit Button add neccessary classes * @since 1.0.0 */ CL_FRONT.contactForm = function(){ if( $('.wpcf7-form').length > 0 ){ $('.wpcf7-form').each(function(){ var $form = $(this); $form.find('.wpcf7-submit').addClass(codeless_global.cl_btn_classes); }); } } /** * Add appropiate btn classes to shop widgets * @since 1.0.0 */ CL_FRONT.shopBtnClasses = function(){ var $btn2 = $('.price_slider_amount .button'); if( $btn2.length > 0 ) $btn2.addClass(codeless_global.cl_btn_classes).removeClass("btn-layout-large").addClass('btn-layout-small').removeClass('btn-font-medium').addClass('btn-font-small'); } /** * Row Parallax Initialize * @since 1.0.0 */ CL_FRONT.rowParallax = function() { "use strict"; if ( $( '.cl-row.cl-parallax > .bg-layer' ).length > 0 ){ $( '.cl-row.cl-parallax > .bg-layer' ).each(function(){ CL_FRONT.components.Parallax( $( this ) ).init(); }) } }; CL_FRONT.shopTabbed = CL_FRONT.init_cl_shop_tabbed = function(){ "use strict"; CL_FRONT.shopInit(); $( '.cl_shop_tabbed > ul > li > a' ).on('click', function(e){ e.preventDefault(); var use_for = $(this).data('load'); var container = $(this).closest( '.cl_shop_tabbed' ).find( '.shop_tabbed_content' ); var height = container.height(); var li = $(this).closest('li'); $(this).closest( 'ul' ).find('li').removeClass( 'active' ); container.css('opacity', 0); li.addClass('active'); container.find('.tab').remove(); container.css('height', height + 'px'); container.prepend('
'); container.css('opacity', 1); $.ajax({ type:"GET", url: window.location.href, data:"use_for_ajax="+use_for, success: function(html){ var $data = $(html).find( '.used_for_ajax' ).html(); container.css('opacity', 0); container.find('md-preloader').remove(); container.css('height', ''); container.html( $data ); container.css('opacity', 1); CL_FRONT.isotopeShop(); CL_FRONT.animations(container, true); CL_FRONT.quickView(); if( $.fn.tawcvs_variation_swatches_form ){ $( '.variations_form' ).tawcvs_variation_swatches_form(); CL_FRONT.shopColorChange(); } } }); }); } /** * Creative Search * @since 1.0.0 */ CL_FRONT.creativeSearch = function(){ 'use strict'; if( $('.search-style-creative').length == 0 ) return; var mainContainer = document.querySelector('#wrapper'), openCtrl = document.getElementById('header_search_btn'), closeCtrl = document.getElementById('btn-search-close'), searchContainer = document.querySelector('.creative-search'); if( searchContainer === null ) return; var inputSearch = searchContainer.querySelector('.search__input'); var init = function() { initEvents(); } var initEvents = function() { openCtrl.addEventListener('click', openSearch); closeCtrl.addEventListener('click', closeSearch); document.addEventListener('keyup', function(ev) { // escape key. if( ev.keyCode == 27 ) { closeSearch(); } }); } var openSearch = function(e) { e.preventDefault(); mainContainer.classList.add('main-wrap--hide'); searchContainer.classList.add('search--open'); setTimeout(function() { inputSearch.focus(); }, 500); } var closeSearch = function() { mainContainer.classList.remove('main-wrap--hide'); searchContainer.classList.remove('search--open'); inputSearch.blur(); inputSearch.value = ''; } init(); }; CL_FRONT.preloadOdometer = CL_FRONT.init_cl_counter = function(){ "use strict"; if( $('.cl_counter') ){ CL_FRONT.components.loadDependencies( [ codeless_global.FRONT_LIB_JS + 'odometer.min.js' ], function() { }); } }; /** * initialize Countdown * @since 1.0.0 */ CL_FRONT.countdownElement = CL_FRONT.init_cl_countdown = function(){ "use strict"; if( $('.cl_countdown').length > 0 ){ CL_FRONT.components.loadDependencies( [ codeless_global.FRONT_LIB_JS + 'jquery.countdown.min.js' ], function() { $('.cl_countdown').each(function(){ var dt = $(this).data('dt'); $(this).countdown(dt, function(event) { var $this = $(this).html(event.strftime('' + '%w weeks' + '%d days' + '%H hours' + '%M min' + '%S sec')); }); }); }); } }; /** * Initialize Odometer counter * @since 1.0.0 */ CL_FRONT.codelessCounter = function(el){ "use strict"; var element = el; CL_FRONT.preloadOdometer(); setTimeout(function(el){ var odometer = element.find('.odometer').first(); var number = odometer.data('number'); var duration = odometer.data('duration'); var el = odometer[0]; var od = new Odometer({ el: el, value: 0, duration: duration, // Any option (other than auto and selector) can be passed in here format: '', theme: 'minimal' }); od.update(parseInt(number)); }, 50); }; /** * Initialize all shop functions * @since 1.0.0 */ CL_FRONT.shopInit = CL_FRONT.init_cl_woocommerce = function(){ "use strict"; CL_FRONT.shopDropDown(); CL_FRONT.isotopeShop(); setTimeout( function(){ CL_FRONT.shopProductThumbnails(); }, 200); }; /** * Add Carousel to thumbnails on product page * @since 1.0.0 */ CL_FRONT.shopProductThumbnails = function(){ if( $('.flex-control-nav.flex-control-thumbs').length == 0 || !CL_FRONT.config.$body.hasClass( 'single-product-style-default' ) ) return; var $data = { responsive: { 0: { items: 3 }, 480: { items: 3 }, 768: { items: 4 }, 992: { items: 4 } }, items: 4, slideBy: 1, nav: true }; $('.flex-control-nav.flex-control-thumbs').addClass('cl-carousel owl-carousel owl-theme'); setTimeout(function(){ CL_FRONT.components.Carousel( $('.flex-control-nav.flex-control-thumbs'), $data ); }, 200); setTimeout(function(){ $( '.woocommerce-product-gallery' ).wc_product_gallery(); }, 400); } /** * Style Woocommerce Dropdown * Load Select2 Plugin JS * @since 1.0.0 */ CL_FRONT.shopDropDown = function(){ var $elements = $( '.woocommerce-ordering .orderby, .variations select, .search-element #clcat, #blog_sort_by, select#shipping_country, select#billing_country, select#billing_state, table.variations .value select, #calc_shipping_country' ); if ( $elements.length ) { $elements.each( function( i ) { var $element = $( this ); var $containerCssClass = ''; if( $element.closest( 'table.variations' ).length > 0 ) $containerCssClass = 'variations_select'; if( $element.closest( '.woocommerce-ordering' ).length > 0 ) $containerCssClass = 'woo_orderby'; if( $element.attr('id') == 'calc_shipping_country' ) $containerCssClass = 'calc_shipping_country'; if( $element.attr('id') == 'billing_country' ) $containerCssClass = 'billing_country'; if( $element.attr('id') == 'shipping_country' ) $containerCssClass = 'shipping_country'; if( $element.attr('id') == 'billing_state' ) $containerCssClass = 'billing_state'; CL_FRONT.components.loadDependencies( [ codeless_global.FRONT_LIB_JS + 'select2.min.js' ], function() { setTimeout(function(){ var sel = $element.select2({ minimumResultsForSearch: Infinity }); sel.data('select2').$container.addClass($containerCssClass); sel.data('select2').$dropdown.addClass($containerCssClass + '_dropdown'); }, 200); }); }); } }; /** * Initialize Single Product Slider with Carousel * @since 1.0.0 */ /*CL_FRONT.shopProductSlider = function(){ if( $( '.cl-images .cl-carousel' ).length > 0 ) CL_FRONT.components.Carousel( $( '.cl-images .cl-carousel' ), { items:1, loop:false, center:true, URLhashListener:true, autoplayHoverPause:true, startPosition: 'URLHash', animateIn: 'alpha-in', animateOut: 'fadeOut' }, function( owl, el ){ var onChangefunc = function(event){ var index = event.item.index; var actived_id = $( event.currentTarget ).find('.active .cl-image-item').attr('data-hash'); var thumbnails = $(event.currentTarget).closest('.images').find('.thumbnails'); thumbnails.find('a').removeClass('active'); thumbnails.find('[href="#'+actived_id+'"]').addClass('active'); }; owl.on('translated.owl.carousel', onChangefunc ); owl.on('initialize.owl.carousel', onChangefunc ); } ); };*/ /*CL_FRONT.shopEasyZoom = function(){ "use strict"; var $elements = $( '.easyzoom' ); if ( $elements.length ) { $elements.each( function( i ) { var $element = $( this ); CL_FRONT.components.loadDependencies( [ codeless_global.FRONT_LIB_JS + 'easyzoom.js' ], function() { var $easyzoom = $element.easyZoom(); }); }); } };/* /** * Isotope Shop Init * used on Customizer too * * @since 1.0.0 */ CL_FRONT.isotopeShop = CL_FRONT.init_cl_woocommerce = CL_FRONT.init_cl_shop_trending = function( $el ) { "use strict"; $( '.shop-products' ).each(function(){ if( $(this).hasClass('cl-carousel') ){ var $data = { responsive: { 0: { items: CL_FRONT.helpers.parseData( codeless_global.shop_columns_mobile, 1 ) }, 480: { items: 2 }, 768: { items: 3 }, 992: { items: $(this).attr('data-grid-cols') } }, items: $(this).attr('data-grid-cols') }; if( $(this).closest('.cl_shop_trending').length > 0 ){ $data = { responsive: { 0: { items: 2 }, 480: { items: 2 }, 768: { items: 4 }, 992: { items: $(this).attr('data-grid-cols') } }, items: $(this).attr('data-grid-cols') }; } CL_FRONT.components.Carousel( $( this ), $data ); } else{ CL_FRONT.components.Isotope( $( this ) ); var $parent = $(this).closest( '#content' ); var $filters = $parent.find( '.grid-options a' ); if( $filters.length > 0 ) $filters.on( 'click', function(e){ e.preventDefault(); $filters.removeClass('active'); $(this).addClass('active'); var $shop = $parent.find('.shop-entries'); $shop.attr('data-grid-cols', $(this).attr( 'data-grid-cols' )); CL_FRONT.components.Isotope( $shop ); } ); } }) }; /** * Manage Customize Partial Refresh * * @since 1.0.0 */ CL_FRONT.partialRefreshRendered = function(){ "use strict"; if( typeof wp === 'undefined' || typeof wp.customize === 'undefined' || typeof wp.customize.selectiveRefresh === 'undefined' ) return false; wp.customize.selectiveRefresh.bind( 'partial-content-rendered', function( placement ) { var postType = ''; if( typeof placement.partial.params.post_type !== 'undefined' ) postType = placement.partial.params.post_type; if( postType == 'portfolio' ) CL_FRONT.init_cl_portfolio(); } ); }; CL_FRONT.footerReveal = function(){ if( $('#footer-wrapper.reveal').length == 0 ) return false; var footerHeight = $('#footer-wrapper').height(); if( this.config.$viewport.hasClass('cl-layout-bordered') ){ $('#footer-wrapper').width( this.config.$main.width() ); } this.config.$main.css( 'margin-bottom', footerHeight ).css( 'background-color', '#ffffff' ).css('position', 'relative').css('z-index', 1); }; CL_FRONT.restartAnimations = function( $el, force ){ if( $el.length == 0 ) return; //$el.find( ' > .start_animation' ).removeClass('start_animation').addClass('animate_on_visible'); setTimeout(function(){ CL_FRONT.animations( $el, force ); }, 20); } /** * Manage Customize Partial Refresh * * @since 1.0.0 * @version 1.0.7 */ CL_FRONT.onePageScroll = function(){ "use strict"; if( CL_FRONT.config.$body.hasClass('cl-one-page') ){ CL_FRONT.components.loadDependencies( [ codeless_global.FRONT_LIB_JS + 'jquery.onepage.js' ], function() { $('#navigation nav .menu').onePageNav({ currentClass: 'current-menu-item-onepage', changeHash: false, scrollSpeed: 750, scrollThreshold: 0.5, offset: CL_FRONT.config.$headerHeight }); }); } } /* -------------------------------------------------------- */ /* ----------------- COMPONENTS TO REUSE ------------------ */ CL_FRONT.components.JustifyGallery = function( container ){ var $elements = container; if ( $elements.length ) { $elements.each( function( i ) { var $element = $( this ); CL_FRONT.components.loadDependencies( [ codeless_global.FRONT_LIB_JS + 'jquery.justifiedGallery.min.js' ], function() { var $data = $element.data(), $rowHeight = parseInt( CL_FRONT.helpers.parseData( $element.attr('data-rowheight'), 200 ) ), $lastRow = 'justify', $margins = parseInt( CL_FRONT.helpers.parseData( $element.attr('data-margins'), 15 ) ); $element.css( {opacity: 0} ); // Load justifyGallery after images loaded $element.imagesLoaded( function() { //CL_FRONT.fixPostVideoHeight(); $element.css( {opacity: 1} ); $element.justifiedGallery({ lastRow: $lastRow, rowHeight: $rowHeight, margins: $margins }); if( typeof CL_FRONT['animations'] !== 'undefined' ) CL_FRONT.animations(); CL_FRONT.rowParallax(); } ); if( $element.hasClass( 'filterable-entries' ) ){ $( '.cl-filters' ).on( 'click', 'button', function() { var filterValue = $(this).attr('data-filter'); if( filterValue != '*' ) $element.justifiedGallery({ filter: filterValue }); else $element.justifiedGallery({ filter: false }); CL_FRONT.restartAnimations( $element ); $(this).parent().find('button.selected').removeClass('selected'); $(this).addClass('selected'); }); } } ); } ); } } CL_FRONT.components.Isotope = function( container ){ var $elements = container; if ( $elements.length ) { $elements.each( function( i ) { var $element = $( this ); CL_FRONT.components.loadDependencies( [ codeless_global.FRONT_LIB_JS + 'isotope.js' ], function() { var $data = $element.data(), $transitionDuration = CL_FRONT.helpers.parseData( $data.transitionDuration, '0.4' ), $layoutMode = CL_FRONT.helpers.parseData( $data.layoutMode, 'masonry' ); $element.css( {opacity: 0} ); // Load isotope after images loaded $element.imagesLoaded( function() { CL_FRONT.fixPostVideoHeight(); if( $element.hasClass('masonry-entries') && $element.is('.blog-entries') ) CL_FRONT.fixPostMasonryHeight( $element ); if( $element.hasClass('masonry-entries') && $element.is('#portfolio-entries') ) CL_FRONT.fixPortfolioMasonryHeight( $element ); $element.css( {opacity: 1} ); var opts = { itemSelector: '.cl-isotope-item', transformsEnabled: true, filter: '*', percentPosition: true, transitionDuration: '0.0s', layoutMode: $layoutMode, }; if( $element.hasClass('portfolio-layout-masonry') ) opts['masonry'] = { columnWidth: '.cl-msn-size-default' }; $element.isotope( opts ); if( typeof CL_FRONT['animations'] !== 'undefined' ) CL_FRONT.restartAnimations( $element ); $element.isotope('arrange'); CL_FRONT.rowParallax(); } ); if( $element.hasClass( 'filterable-entries' ) ){ $( '.cl-filters' ).on( 'click', 'button', function() { var filterValue = $(this).attr('data-filter'); if( filterValue != '*' ) $element.isotope({ filter: filterValue, sortBy: 'random' }); else $element.isotope({ filter: filterValue, sortBy: 'original-order' }); CL_FRONT.restartAnimations( $element ); $element.isotope('arrange'); $(this).parent().find('button.selected').removeClass('selected'); $(this).addClass('selected'); }); } } ); } ); } } /** * Carousel Component to be used over pages * @since 1.0.0 */ CL_FRONT.components.Carousel = function( el, data_obj, callback ){ if( el != null ){ CL_FRONT.components.loadDependencies( [ codeless_global.FRONT_LIB_JS + 'owl.carousel.min.js'], function() { var $data = { responsive: { 0: { items: 1 }, 480: { items: 2 }, 768: { items: 3 }, 992: { items: el.attr('data-grid-cols') } }, items: el.attr('data-grid-cols') }; if( data_obj != null ) $data = data_obj; if( typeof $data['nav'] === 'undefined' ) $data['nav'] = parseInt( CL_FRONT.helpers.parseData( el.data('carouselNav') , false ) ); if( typeof $data['dots'] === 'undefined' ) $data['dots'] = parseInt( CL_FRONT.helpers.parseData( el.data('carouselDots') , false ) ); el.imagesLoaded( function() { var owl = el.owlCarousel($data); CL_FRONT.animations( el.find( '.owl-item.active'), true ); owl.on('translated.owl.carousel', function(event) { CL_FRONT.animations( el.find( '.owl-item.active' ), true ); }); if( callback != null ) callback(owl, el); }); }); } }; /** * iLightbox Component * @since 1.0.0 */ CL_FRONT.components.LightBox = function( el ){ "use strict"; if( el != null ){ CL_FRONT.components.loadDependencies( [ codeless_global.FRONT_LIB_JS + 'jquery.requestAnimationFrame.js', codeless_global.FRONT_LIB_JS + 'jquery.mousewheel.js', codeless_global.FRONT_LIB_JS + 'ilightbox.packed.js' ], function() { el.iLightBox({skin: 'dark'}); }); } }; /** * lazyload Component * @since 1.0.0 */ CL_FRONT.components.LazyLoad = function( container ){ "use strict"; if( container == null ){ container = window; } CL_FRONT.components.loadDependencies( [ codeless_global.FRONT_LIB_JS + 'lazyload.min.js' ], function() { var myLazyLoad = new LazyLoad({ container: container, elements_selector: '.lazyload' }); }); }; /** * Parallax Effect Used on various parts of site * @since 1.0.0 */ CL_FRONT.components.Parallax = function( el ) { "use strict"; var self = this, $this = el , obj = $this[ 0 ], config = $this.data( 'parallax-config' ), headerHeight = null, offset = null, elHeight = null, ticking = false, isMobile = null; var clientRect = null; if( config == null ) config = { speed: 0.3 }; var update = function() { // Update Positions obj.style.transform = null; obj.style.top = null; obj.style.bottom = null; if ( CL_FRONT.config.$isMobileScreen ) { $this.css( 'height', '' ); return; } clientRect = $this[ 0 ].getBoundingClientRect(); offset = clientRect.top; elHeight = clientRect.height; headerHeight = 0; offset = offset - headerHeight + CL_FRONT.config.$windowTop; setPosition(); setSize(); }; var h = 0, winH = 0, proportion = 0, height = 0; var setSize = function() { $this.css( 'height', '' ); winH = CL_FRONT.config.$window.height() - headerHeight; h = obj.getBoundingClientRect().height; if ( config.speed <= 1 && config.speed > 0 ) { if ( offset === 0 ) { $this.css( { backgroundAttachment: 'scroll', 'will-change': 'transform' } ); } else { $this.css( { height: h + ( ( winH - h ) * config.speed ), backgroundAttachment: 'scroll', 'will-change': 'transform' } ); } } else if ( config.speed > 1 && h <= winH ) { $this.css( { // good for full heights - 2 because it's viewable by 2 screen heights height: ( winH + ( ( winH * config.speed ) - winH ) * 2 ), top: -( ( winH * config.speed ) - winH ), backgroundAttachment: 'scroll', 'will-change': 'transform' } ); } else if ( config.speed > 1 && h > winH ) { proportion = h / winH; height = ( winH + ( ( winH * config.speed ) - winH ) * ( 1 + proportion ) ); $this.css( { height: height, top: -( height - ( winH * config.speed ) ), backgroundAttachment: 'scroll', 'will-change': 'transform' } ); } else if ( config.speed < 0 && h >= winH ) { height = h * ( 1 - config.speed ); $this.css( { height: height + ( height - h ), top: h - height, backgroundAttachment: 'scroll', 'will-change': 'transform' } ); } else if ( config.speed < 0 && h < winH ) { // candidate to change var display = ( winH + h ) / winH; height = h * -config.speed * display; $this.css( { height: h + ( height * 2 ), top: -height, backgroundAttachment: 'scroll', 'will-change': 'transform' } ); } }; var currentPoint = null, progressVal = null, startPoint = null, endPoint = null, scrollY = null; var setPosition = function() { ticking = false; if( scrollY == null ) scrollY = window.scrollY; var currentScrollY = scrollY; if (!CL_FRONT.config.$isMobileScreen){ startPoint = offset - winH; endPoint = offset + elHeight + winH - headerHeight; if ( currentScrollY < startPoint || currentScrollY > endPoint ) { ticking = false; return; } currentPoint = ( ( -offset + currentScrollY ) * config.speed ); $this.css( { '-webkit-transform': 'translateY(' + currentPoint + 'px) translateZ(0)', '-moz-transform': 'translateY(' + currentPoint + 'px) translateZ(0)', '-ms-transform': 'translateY(' + currentPoint + 'px) translateZ(0)', '-o-transform': 'translateY(' + currentPoint + 'px) translateZ(0)', 'transform': 'translateY(' + currentPoint + 'px) translateZ(0)' } ); } }; var requestTick = function() { if ( !ticking ) { window.requestAnimationFrame( setPosition ); } ticking = true; }; var onScroll = function(){ scrollY = window.scrollY; requestTick(); } var init = function() { // Disable scroll effects when smooth scroll is disabled if ( !CL_FRONT.config.$isSmoothScroll || CL_FRONT.config.$isCustomizer ) { return; } update(); setTimeout( update, 300 ); CL_FRONT.config.$window.on( 'load', update ); CL_FRONT.config.$window.on( 'resize', update ); window.addEventListener('scroll', onScroll, false); }; return { init: init }; }; CL_FRONT.components.loadAnimation = function( content, callback ){ content.imagesLoaded( { background: true }, function(list){ callback(); content.addClass( 'cl-loaded-component' ); }); }; /** * Core function for loading dinamically JS * * @since 1.0.0 */ CL_FRONT.components.loadDependencies = function( dependencies, callback ) { "use strict"; var _callback = callback || function() {}; if ( !dependencies ) return void _callback(); var newDeps = dependencies.map( function( dep ) { return -1 === CL_FRONT.config._loadedDependencies.indexOf( dep ) ? "undefined" == typeof CL_FRONT.config._inQueue[ dep ] ? dep : ( CL_FRONT.config._inQueue[ dep ].push( _callback ), !0 ) : !1 } ); if ( newDeps[ 0 ] !== !0 ) { if ( newDeps[ 0 ] === !1 ) return void _callback(); var queue = newDeps.map( function( script ) { CL_FRONT.config._inQueue[ script ] = [ _callback ]; return $.getCachedScript( script ); } ); var onLoad = function() { newDeps.map( function( loaded ) { CL_FRONT.config._inQueue[ loaded ].forEach( function( callback ) { callback() } ); delete CL_FRONT.config._inQueue[ loaded ]; CL_FRONT.config._loadedDependencies.push( loaded ) } ); }; $.when.apply( null, queue ).done( onLoad ) } }; /* ---------------------------------------------------*/ /* ------------------ HELPERS FUNCTIONS --------------*/ CL_FRONT.helpers.changeHeaderColor = function(element){ var color = 'dark'; if( CL_FRONT.config.$header.hasClass('cl-header-sticky-active') ) return; if( element.find('.cl-row').hasClass('light-text') ) color = 'light'; if( color == 'light' && ! CL_FRONT.config.$header.hasClass('cl-header-light') ){ CL_FRONT.config.$header.addClass('cl-header-light'); CL_FRONT.config.$body.addClass('cl-header-light'); } if( color == 'dark' && CL_FRONT.config.$header.hasClass('cl-header-light') ){ CL_FRONT.config.$header.removeClass('cl-header-light'); CL_FRONT.config.$body.removeClass('cl-header-light'); } }; CL_FRONT.helpers.recognizeColor = function(color){ var rgb = ''; if( CL_FRONT.helpers.includes(color, 'rgb') ){ var match = color.match(/rgba?\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})\)?(?:, ?(\d(?:\.\d?))\))?/); rgb = match ? { 0: match[1], 1: match[2], 2: match[3] } : {}; }else{ var isOk = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(color); if( ! isOk ) return 'none'; rgb = CL_FRONT.helpers.hexToRgb(color); } var o = Math.round(((parseInt(rgb[0]) * 299) + (parseInt(rgb[1]) * 587) + (parseInt(rgb[2]) * 114)) /1000); if(o > 125) { return 'light'; }else{ return 'black'; } }; CL_FRONT.helpers.hexToRgb = function(hex){ var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); return result ? { r: parseInt(result[1], 16), g: parseInt(result[2], 16), b: parseInt(result[3], 16) } : null; }; CL_FRONT.helpers.includes = function(container, value){ var returnValue = false; var pos = container.indexOf(value); if (pos >= 0) { returnValue = true; } return returnValue; }; CL_FRONT.helpers.loadCSS = function(href){ var ss = document.styleSheets; for (var i = 0, max = ss.length; i < max; i++) { if (ss[i].href == href) return; } var link = document.createElement("link"); link.rel = "stylesheet"; link.href = href; document.getElementsByTagName("head")[0].appendChild(link); } /** * Core function for loading dinamically JS * * @since 1.0.0 */ $.getCachedScript = function( url, callback ) { "use strict"; url = url.replace( /.*?:\/\//g, "" ); if ( location.protocol === 'https:' ) url = 'https://' + url; else url = 'http://' + url; var options = { dataType: "script", cache: false, url: url }; return $.ajax( options ).done( callback ); }; /** * parse and sanitize value * * @since 1.0.0 */ CL_FRONT.helpers.parseData = function( val, fallback ) { "use strict"; return ( typeof val !== 'undefined' ) ? val : fallback; }; CL_FRONT.helpers.scroll = function() { "use strict"; var offset = 0, $window = $(window), hasPageYOffset = (window.pageYOffset !== undefined), body = (document.documentElement || document.body.parentNode || document.body); var update = function() { offset = hasPageYOffset ? window.pageYOffset : body.scrollTop; }; var rAF = function() { window.requestAnimationFrame(update); }; update(); $window.on('load', update); $window.on('resize', update); $window.on('scroll', rAF); return offset; }; function initGMAP(){ CL_FRONT.codelessGMap(); } CL_FRONT.siteInit(); if( typeof CL_FRONT.animations == 'undefined' ){ CL_FRONT.animations = function( el, force ) { if (!window.waypoint_animation) { window.waypoint_animation = function(el, force) { var notEl = (el == null) ? true : false; if( el == null ) el = $('.animate_on_visible:not(.start_animation)'); else el = el.find('.animate_on_visible:not(.start_animation)').andSelf(); $.each(el, function(index, val) { var run = true; if ($(val).closest('.cl-slide').length > 0) run = false; if ($(val).closest('.cl-carousel').length > 0) run = false; if ($(val).closest('#navigation').length > 0) run = false; if( force ) run = true; if (run) { CL_FRONT.components.loadDependencies([codeless_global.FRONT_LIB_JS + "waypoints.min.js"], function(){ Waypoint.refreshAll(); new Waypoint({ element: val, handler: function() { var element = $(this.element), index = element.index(), delayAttr = element.attr('data-delay'); if( CL_FRONT.config.$isMobileScreen && element.parent().attr('data-grid-cols') ) delayAttr = 100; if (delayAttr == undefined) delayAttr = 0; setTimeout(function() { element.addClass('start_animation'); if( element.hasClass('cl_counter') ) CL_FRONT.codelessCounter(element); if( element.hasClass('cl_progress_bar') ) CL_FRONT.progressBar( element ); }, delayAttr); this.destroy(); }, offset: '90%' }); }); } }); } } setTimeout(function() { window.waypoint_animation(el, force); }, 1); }; } } )( jQuery ); // source --> https://www.carminedisiero.it/wp-content/themes/june/js/bowser.min.js?ver=5.4 /*! * Bowser - a browser detector * https://github.com/ded/bowser * MIT License | (c) Dustin Diaz 2015 */ !function(e,t,n){typeof module!="undefined"&&module.exports?module.exports=n():typeof define=="function"&&define.amd?define(t,n):e[t]=n()}(this,"bowser",function(){function t(t){function n(e){var n=t.match(e);return n&&n.length>1&&n[1]||""}function r(e){var n=t.match(e);return n&&n.length>1&&n[2]||""}var i=n(/(ipod|iphone|ipad)/i).toLowerCase(),s=/like android/i.test(t),o=!s&&/android/i.test(t),u=/nexus\s*[0-6]\s*/i.test(t),a=!u&&/nexus\s*[0-9]+/i.test(t),f=/CrOS/.test(t),l=/silk/i.test(t),c=/sailfish/i.test(t),h=/tizen/i.test(t),p=/(web|hpw)os/i.test(t),d=/windows phone/i.test(t),v=/SamsungBrowser/i.test(t),m=!d&&/windows/i.test(t),g=!i&&!l&&/macintosh/i.test(t),y=!o&&!c&&!h&&!p&&/linux/i.test(t),b=n(/edge\/(\d+(\.\d+)?)/i),w=n(/version\/(\d+(\.\d+)?)/i),E=/tablet/i.test(t),S=!E&&/[^-]mobi/i.test(t),x=/xbox/i.test(t),T;/opera/i.test(t)?T={name:"Opera",opera:e,version:w||n(/(?:opera|opr|opios)[\s\/](\d+(\.\d+)?)/i)}:/opr|opios/i.test(t)?T={name:"Opera",opera:e,version:n(/(?:opr|opios)[\s\/](\d+(\.\d+)?)/i)||w}:/SamsungBrowser/i.test(t)?T={name:"Samsung Internet for Android",samsungBrowser:e,version:w||n(/(?:SamsungBrowser)[\s\/](\d+(\.\d+)?)/i)}:/coast/i.test(t)?T={name:"Opera Coast",coast:e,version:w||n(/(?:coast)[\s\/](\d+(\.\d+)?)/i)}:/yabrowser/i.test(t)?T={name:"Yandex Browser",yandexbrowser:e,version:w||n(/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i)}:/ucbrowser/i.test(t)?T={name:"UC Browser",ucbrowser:e,version:n(/(?:ucbrowser)[\s\/](\d+(?:\.\d+)+)/i)}:/mxios/i.test(t)?T={name:"Maxthon",maxthon:e,version:n(/(?:mxios)[\s\/](\d+(?:\.\d+)+)/i)}:/epiphany/i.test(t)?T={name:"Epiphany",epiphany:e,version:n(/(?:epiphany)[\s\/](\d+(?:\.\d+)+)/i)}:/puffin/i.test(t)?T={name:"Puffin",puffin:e,version:n(/(?:puffin)[\s\/](\d+(?:\.\d+)?)/i)}:/sleipnir/i.test(t)?T={name:"Sleipnir",sleipnir:e,version:n(/(?:sleipnir)[\s\/](\d+(?:\.\d+)+)/i)}:/k-meleon/i.test(t)?T={name:"K-Meleon",kMeleon:e,version:n(/(?:k-meleon)[\s\/](\d+(?:\.\d+)+)/i)}:d?(T={name:"Windows Phone",windowsphone:e},b?(T.msedge=e,T.version=b):(T.msie=e,T.version=n(/iemobile\/(\d+(\.\d+)?)/i))):/msie|trident/i.test(t)?T={name:"Internet Explorer",msie:e,version:n(/(?:msie |rv:)(\d+(\.\d+)?)/i)}:f?T={name:"Chrome",chromeos:e,chromeBook:e,chrome:e,version:n(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:/chrome.+? edge/i.test(t)?T={name:"Microsoft Edge",msedge:e,version:b}:/vivaldi/i.test(t)?T={name:"Vivaldi",vivaldi:e,version:n(/vivaldi\/(\d+(\.\d+)?)/i)||w}:c?T={name:"Sailfish",sailfish:e,version:n(/sailfish\s?browser\/(\d+(\.\d+)?)/i)}:/seamonkey\//i.test(t)?T={name:"SeaMonkey",seamonkey:e,version:n(/seamonkey\/(\d+(\.\d+)?)/i)}:/firefox|iceweasel|fxios/i.test(t)?(T={name:"Firefox",firefox:e,version:n(/(?:firefox|iceweasel|fxios)[ \/](\d+(\.\d+)?)/i)},/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(t)&&(T.firefoxos=e)):l?T={name:"Amazon Silk",silk:e,version:n(/silk\/(\d+(\.\d+)?)/i)}:/phantom/i.test(t)?T={name:"PhantomJS",phantom:e,version:n(/phantomjs\/(\d+(\.\d+)?)/i)}:/slimerjs/i.test(t)?T={name:"SlimerJS",slimer:e,version:n(/slimerjs\/(\d+(\.\d+)?)/i)}:/blackberry|\bbb\d+/i.test(t)||/rim\stablet/i.test(t)?T={name:"BlackBerry",blackberry:e,version:w||n(/blackberry[\d]+\/(\d+(\.\d+)?)/i)}:p?(T={name:"WebOS",webos:e,version:w||n(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)},/touchpad\//i.test(t)&&(T.touchpad=e)):/bada/i.test(t)?T={name:"Bada",bada:e,version:n(/dolfin\/(\d+(\.\d+)?)/i)}:h?T={name:"Tizen",tizen:e,version:n(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i)||w}:/qupzilla/i.test(t)?T={name:"QupZilla",qupzilla:e,version:n(/(?:qupzilla)[\s\/](\d+(?:\.\d+)+)/i)||w}:/chromium/i.test(t)?T={name:"Chromium",chromium:e,version:n(/(?:chromium)[\s\/](\d+(?:\.\d+)?)/i)||w}:/chrome|crios|crmo/i.test(t)?T={name:"Chrome",chrome:e,version:n(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:o?T={name:"Android",version:w}:/safari|applewebkit/i.test(t)?(T={name:"Safari",safari:e},w&&(T.version=w)):i?(T={name:i=="iphone"?"iPhone":i=="ipad"?"iPad":"iPod"},w&&(T.version=w)):/googlebot/i.test(t)?T={name:"Googlebot",googlebot:e,version:n(/googlebot\/(\d+(\.\d+))/i)||w}:T={name:n(/^(.*)\/(.*) /),version:r(/^(.*)\/(.*) /)},!T.msedge&&/(apple)?webkit/i.test(t)?(/(apple)?webkit\/537\.36/i.test(t)?(T.name=T.name||"Blink",T.blink=e):(T.name=T.name||"Webkit",T.webkit=e),!T.version&&w&&(T.version=w)):!T.opera&&/gecko\//i.test(t)&&(T.name=T.name||"Gecko",T.gecko=e,T.version=T.version||n(/gecko\/(\d+(\.\d+)?)/i)),!T.windowsphone&&!T.msedge&&(o||T.silk)?T.android=e:!T.windowsphone&&!T.msedge&&i?(T[i]=e,T.ios=e):g?T.mac=e:x?T.xbox=e:m?T.windows=e:y&&(T.linux=e);var N="";T.windowsphone?N=n(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i):i?(N=n(/os (\d+([_\s]\d+)*) like mac os x/i),N=N.replace(/[_\s]/g,".")):o?N=n(/android[ \/-](\d+(\.\d+)*)/i):T.webos?N=n(/(?:web|hpw)os\/(\d+(\.\d+)*)/i):T.blackberry?N=n(/rim\stablet\sos\s(\d+(\.\d+)*)/i):T.bada?N=n(/bada\/(\d+(\.\d+)*)/i):T.tizen&&(N=n(/tizen[\/\s](\d+(\.\d+)*)/i)),N&&(T.osversion=N);var C=N.split(".")[0];if(E||a||i=="ipad"||o&&(C==3||C>=4&&!S)||T.silk)T.tablet=e;else if(S||i=="iphone"||i=="ipod"||o||u||T.blackberry||T.webos||T.bada)T.mobile=e;return T.msedge||T.msie&&T.version>=10||T.yandexbrowser&&T.version>=15||T.vivaldi&&T.version>=1||T.chrome&&T.version>=20||T.samsungBrowser&&T.version>=4||T.firefox&&T.version>=20||T.safari&&T.version>=6||T.opera&&T.version>=10||T.ios&&T.osversion&&T.osversion.split(".")[0]>=6||T.blackberry&&T.version>=10.1||T.chromium&&T.version>=20?T.a=e:T.msie&&T.version<10||T.chrome&&T.version<20||T.firefox&&T.version<20||T.safari&&T.version<6||T.opera&&T.version<10||T.ios&&T.osversion&&T.osversion.split(".")[0]<6||T.chromium&&T.version<20?T.c=e:T.x=e,T}function r(e){return e.split(".").length}function i(e,t){var n=[],r;if(Array.prototype.map)return Array.prototype.map.call(e,t);for(r=0;r=0){if(n[0][t]>n[1][t])return 1;if(n[0][t]!==n[1][t])return-1;if(t===0)return 0}}function o(e,r,i){var o=n;typeof r=="string"&&(i=r,r=void 0),r===void 0&&(r=!1),i&&(o=t(i));var u=""+o.version;for(var a in e)if(e.hasOwnProperty(a)&&o[a]){if(typeof e[a]!="string")throw new Error("Browser version in the minVersion map should be a string: "+a+": "+String(e));return s([u,e[a]])<0}return r}function u(e,t,n){return!o(e,t,n)}var e=!0,n=t(typeof navigator!="undefined"?navigator.userAgent||"":"");return n.test=function(e){for(var t=0;t https://www.carminedisiero.it/wp-content/themes/june/js/smoothscroll.js?ver=5.4 // // SmoothScroll for websites v1.4.6 (Balazs Galambosi) // http://www.smoothscroll.net/ // // Licensed under the terms of the MIT license. // // You may use it in your theme if you credit me. // It is also free to use on any individual website. // // Exception: // The only restriction is to not publish any // extension for browsers or native application // without getting a written permission first. // (function () { // Scroll Variables (tweakable) var defaultOptions = { // Scrolling Core frameRate : 150, // [Hz] animationTime : 400, // [ms] stepSize : 100, // [px] // Pulse (less tweakable) // ratio of "tail" to "acceleration" pulseAlgorithm : true, pulseScale : 4, pulseNormalize : 1, // Acceleration accelerationDelta : 50, // 50 accelerationMax : 3, // 3 // Keyboard Settings keyboardSupport : true, // option arrowScroll : 50, // [px] // Other fixedBackground : true, touchpadSupport : true, excluded : '' }; var options = defaultOptions; // Other Variables var isExcluded = false; var isFrame = false; var direction = { x: 0, y: 0 }; var initDone = false; var root = document.documentElement; var activeElement; var observer; var refreshSize; var deltaBuffer = []; var isMac = /^Mac/.test(navigator.platform); var key = { left: 37, up: 38, right: 39, down: 40, spacebar: 32, pageup: 33, pagedown: 34, end: 35, home: 36 }; var arrowKeys = { 37: 1, 38: 1, 39: 1, 40: 1 }; /*********************************************** * INITIALIZE ***********************************************/ /** * Tests if smooth scrolling is allowed. Shuts down everything if not. */ function initTest() { if (options.keyboardSupport) { addEvent('keydown', keydown); } } /** * Sets up scrolls array, determines if frames are involved. */ function init() { if (initDone || !document.body) return; initDone = true; var body = document.body; var html = document.documentElement; var windowHeight = window.innerHeight; var scrollHeight = body.scrollHeight; // check compat mode for root element root = (document.compatMode.indexOf('CSS') >= 0) ? html : body; activeElement = body; initTest(); // Checks if this script is running in a frame if (top != self) { isFrame = true; } /** * Safari 10 fixed it, Chrome fixed it in v45: * This fixes a bug where the areas left and right to * the content does not trigger the onmousewheel event * on some pages. e.g.: html, body { height: 100% } */ else if (isOldSafari && scrollHeight > windowHeight && (body.offsetHeight <= windowHeight || html.offsetHeight <= windowHeight)) { var fullPageElem = document.createElement('div'); fullPageElem.style.cssText = 'position:absolute; z-index:-10000; ' + 'top:0; left:0; right:0; height:' + root.scrollHeight + 'px'; document.body.appendChild(fullPageElem); // DOM changed (throttled) to fix height var pendingRefresh; refreshSize = function () { if (pendingRefresh) return; // could also be: clearTimeout(pendingRefresh); pendingRefresh = setTimeout(function () { if (isExcluded) return; // could be running after cleanup fullPageElem.style.height = '0'; fullPageElem.style.height = root.scrollHeight + 'px'; pendingRefresh = null; }, 500); // act rarely to stay fast }; setTimeout(refreshSize, 10); addEvent('resize', refreshSize); // TODO: attributeFilter? var config = { attributes: true, childList: true, characterData: false // subtree: true }; observer = new MutationObserver(refreshSize); observer.observe(body, config); if (root.offsetHeight <= windowHeight) { var clearfix = document.createElement('div'); clearfix.style.clear = 'both'; body.appendChild(clearfix); } } // disable fixed background if (!options.fixedBackground && !isExcluded) { body.style.backgroundAttachment = 'scroll'; html.style.backgroundAttachment = 'scroll'; } } /** * Removes event listeners and other traces left on the page. */ function cleanup() { observer && observer.disconnect(); removeEvent(wheelEvent, wheel); removeEvent('mousedown', mousedown); removeEvent('keydown', keydown); removeEvent('resize', refreshSize); removeEvent('load', init); } /************************************************ * SCROLLING ************************************************/ var que = []; var pending = false; var lastScroll = Date.now(); /** * Pushes scroll actions to the scrolling queue. */ function scrollArray(elem, left, top) { directionCheck(left, top); if (options.accelerationMax != 1) { var now = Date.now(); var elapsed = now - lastScroll; if (elapsed < options.accelerationDelta) { var factor = (1 + (50 / elapsed)) / 2; if (factor > 1) { factor = Math.min(factor, options.accelerationMax); left *= factor; top *= factor; } } lastScroll = Date.now(); } // push a scroll command que.push({ x: left, y: top, lastX: (left < 0) ? 0.99 : -0.99, lastY: (top < 0) ? 0.99 : -0.99, start: Date.now() }); // don't act if there's a pending queue if (pending) { return; } var scrollWindow = (elem === document.body); var step = function (time) { var now = Date.now(); var scrollX = 0; var scrollY = 0; for (var i = 0; i < que.length; i++) { var item = que[i]; var elapsed = now - item.start; var finished = (elapsed >= options.animationTime); // scroll position: [0, 1] var position = (finished) ? 1 : elapsed / options.animationTime; // easing [optional] if (options.pulseAlgorithm) { position = pulse(position); } // only need the difference var x = (item.x * position - item.lastX) >> 0; var y = (item.y * position - item.lastY) >> 0; // add this to the total scrolling scrollX += x; scrollY += y; // update last values item.lastX += x; item.lastY += y; // delete and step back if it's over if (finished) { que.splice(i, 1); i--; } } // scroll left and top if (scrollWindow) { window.scrollBy(scrollX, scrollY); } else { if (scrollX) elem.scrollLeft += scrollX; if (scrollY) elem.scrollTop += scrollY; } // clean up if there's nothing left to do if (!left && !top) { que = []; } if (que.length) { requestFrame(step, elem, (1000 / options.frameRate + 1)); } else { pending = false; } }; // start a new queue of actions requestFrame(step, elem, 0); pending = true; } /*********************************************** * EVENTS ***********************************************/ /** * Mouse wheel handler. * @param {Object} event */ function wheel(event) { if (!initDone) { init(); } var target = event.target; // leave early if default action is prevented // or it's a zooming event with CTRL if (event.defaultPrevented || event.ctrlKey) { return true; } // leave embedded content alone (flash & pdf) if (isNodeName(activeElement, 'embed') || (isNodeName(target, 'embed') && /\.pdf/i.test(target.src)) || isNodeName(activeElement, 'object') || target.shadowRoot) { return true; } var deltaX = -event.wheelDeltaX || event.deltaX || 0; var deltaY = -event.wheelDeltaY || event.deltaY || 0; if (isMac) { if (event.wheelDeltaX && isDivisible(event.wheelDeltaX, 120)) { deltaX = -120 * (event.wheelDeltaX / Math.abs(event.wheelDeltaX)); } if (event.wheelDeltaY && isDivisible(event.wheelDeltaY, 120)) { deltaY = -120 * (event.wheelDeltaY / Math.abs(event.wheelDeltaY)); } } // use wheelDelta if deltaX/Y is not available if (!deltaX && !deltaY) { deltaY = -event.wheelDelta || 0; } // line based scrolling (Firefox mostly) if (event.deltaMode === 1) { deltaX *= 40; deltaY *= 40; } var overflowing = overflowingAncestor(target); // nothing to do if there's no element that's scrollable if (!overflowing) { // except Chrome iframes seem to eat wheel events, which we need to // propagate up, if the iframe has nothing overflowing to scroll if (isFrame && isChrome) { // change target to iframe element itself for the parent frame Object.defineProperty(event, "target", {value: window.frameElement}); return parent.wheel(event); } return true; } // check if it's a touchpad scroll that should be ignored if (isTouchpad(deltaY)) { return true; } // scale by step size // delta is 120 most of the time // synaptics seems to send 1 sometimes if (Math.abs(deltaX) > 1.2) { deltaX *= options.stepSize / 120; } if (Math.abs(deltaY) > 1.2) { deltaY *= options.stepSize / 120; } scrollArray(overflowing, deltaX, deltaY); event.preventDefault(); scheduleClearCache(); } /** * Keydown event handler. * @param {Object} event */ function keydown(event) { var target = event.target; var modifier = event.ctrlKey || event.altKey || event.metaKey || (event.shiftKey && event.keyCode !== key.spacebar); // our own tracked active element could've been removed from the DOM if (!document.body.contains(activeElement)) { activeElement = document.activeElement; } // do nothing if user is editing text // or using a modifier key (except shift) // or in a dropdown // or inside interactive elements var inputNodeNames = /^(textarea|select|embed|object)$/i; var buttonTypes = /^(button|submit|radio|checkbox|file|color|image)$/i; if ( event.defaultPrevented || inputNodeNames.test(target.nodeName) || isNodeName(target, 'input') && !buttonTypes.test(target.type) || isNodeName(activeElement, 'video') || isInsideYoutubeVideo(event) || target.isContentEditable || modifier ) { return true; } // [spacebar] should trigger button press, leave it alone if ((isNodeName(target, 'button') || isNodeName(target, 'input') && buttonTypes.test(target.type)) && event.keyCode === key.spacebar) { return true; } // [arrwow keys] on radio buttons should be left alone if (isNodeName(target, 'input') && target.type == 'radio' && arrowKeys[event.keyCode]) { return true; } var shift, x = 0, y = 0; var overflowing = overflowingAncestor(activeElement); if (!overflowing) { // Chrome iframes seem to eat key events, which we need to // propagate up, if the iframe has nothing overflowing to scroll return (isFrame && isChrome) ? parent.keydown(event) : true; } var clientHeight = overflowing.clientHeight; if (overflowing == document.body) { clientHeight = window.innerHeight; } switch (event.keyCode) { case key.up: y = -options.arrowScroll; break; case key.down: y = options.arrowScroll; break; case key.spacebar: // (+ shift) shift = event.shiftKey ? 1 : -1; y = -shift * clientHeight * 0.9; break; case key.pageup: y = -clientHeight * 0.9; break; case key.pagedown: y = clientHeight * 0.9; break; case key.home: y = -overflowing.scrollTop; break; case key.end: var scroll = overflowing.scrollHeight - overflowing.scrollTop; var scrollRemaining = scroll - clientHeight; y = (scrollRemaining > 0) ? scrollRemaining + 10 : 0; break; case key.left: x = -options.arrowScroll; break; case key.right: x = options.arrowScroll; break; default: return true; // a key we don't care about } scrollArray(overflowing, x, y); event.preventDefault(); scheduleClearCache(); } /** * Mousedown event only for updating activeElement */ function mousedown(event) { activeElement = event.target; } /*********************************************** * OVERFLOW ***********************************************/ var uniqueID = (function () { var i = 0; return function (el) { return el.uniqueID || (el.uniqueID = i++); }; })(); var cache = {}; // cleared out after a scrolling session var clearCacheTimer; //setInterval(function () { cache = {}; }, 10 * 1000); function scheduleClearCache() { clearTimeout(clearCacheTimer); clearCacheTimer = setInterval(function () { cache = {}; }, 1*1000); } function setCache(elems, overflowing) { for (var i = elems.length; i--;) cache[uniqueID(elems[i])] = overflowing; return overflowing; } // (body) (root) // | hidden | visible | scroll | auto | // hidden | no | no | YES | YES | // visible | no | YES | YES | YES | // scroll | no | YES | YES | YES | // auto | no | YES | YES | YES | function overflowingAncestor(el) { var elems = []; var body = document.body; var rootScrollHeight = root.scrollHeight; do { var cached = cache[uniqueID(el)]; if (cached) { return setCache(elems, cached); } elems.push(el); if (rootScrollHeight === el.scrollHeight) { var topOverflowsNotHidden = overflowNotHidden(root) && overflowNotHidden(body); var isOverflowCSS = topOverflowsNotHidden || overflowAutoOrScroll(root); if (isFrame && isContentOverflowing(root) || !isFrame && isOverflowCSS) { return setCache(elems, getScrollRoot()); } } else if (isContentOverflowing(el) && overflowAutoOrScroll(el)) { return setCache(elems, el); } } while (el = el.parentElement); } function isContentOverflowing(el) { return (el.clientHeight + 10 < el.scrollHeight); } // typically for and function overflowNotHidden(el) { var overflow = getComputedStyle(el, '').getPropertyValue('overflow-y'); return (overflow !== 'hidden'); } // for all other elements function overflowAutoOrScroll(el) { var overflow = getComputedStyle(el, '').getPropertyValue('overflow-y'); return (overflow === 'scroll' || overflow === 'auto'); } /*********************************************** * HELPERS ***********************************************/ function addEvent(type, fn) { window.addEventListener(type, fn, false); } function removeEvent(type, fn) { window.removeEventListener(type, fn, false); } function isNodeName(el, tag) { return (el.nodeName||'').toLowerCase() === tag.toLowerCase(); } function directionCheck(x, y) { x = (x > 0) ? 1 : -1; y = (y > 0) ? 1 : -1; if (direction.x !== x || direction.y !== y) { direction.x = x; direction.y = y; que = []; lastScroll = 0; } } var deltaBufferTimer; if (window.localStorage && localStorage.SS_deltaBuffer) { try { // #46 Safari throws in private browsing for localStorage deltaBuffer = localStorage.SS_deltaBuffer.split(','); } catch (e) { } } function isTouchpad(deltaY) { if (!deltaY) return; if (!deltaBuffer.length) { deltaBuffer = [deltaY, deltaY, deltaY]; } deltaY = Math.abs(deltaY); deltaBuffer.push(deltaY); deltaBuffer.shift(); clearTimeout(deltaBufferTimer); deltaBufferTimer = setTimeout(function () { try { // #46 Safari throws in private browsing for localStorage localStorage.SS_deltaBuffer = deltaBuffer.join(','); } catch (e) { } }, 1000); return !allDeltasDivisableBy(120) && !allDeltasDivisableBy(100); } function isDivisible(n, divisor) { return (Math.floor(n / divisor) == n / divisor); } function allDeltasDivisableBy(divisor) { return (isDivisible(deltaBuffer[0], divisor) && isDivisible(deltaBuffer[1], divisor) && isDivisible(deltaBuffer[2], divisor)); } function isInsideYoutubeVideo(event) { var elem = event.target; var isControl = false; if (document.URL.indexOf ('www.youtube.com/watch') != -1) { do { isControl = (elem.classList && elem.classList.contains('html5-video-controls')); if (isControl) break; } while (elem = elem.parentNode); } return isControl; } var requestFrame = (function () { return (window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function (callback, element, delay) { window.setTimeout(callback, delay || (1000/60)); }); })(); var MutationObserver = (window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver); var getScrollRoot = (function() { var SCROLL_ROOT; return function() { if (!SCROLL_ROOT) { var dummy = document.createElement('div'); dummy.style.cssText = 'height:10000px;width:1px;'; document.body.appendChild(dummy); var bodyScrollTop = document.body.scrollTop; var docElScrollTop = document.documentElement.scrollTop; window.scrollBy(0, 3); if (document.body.scrollTop != bodyScrollTop) (SCROLL_ROOT = document.body); else (SCROLL_ROOT = document.documentElement); window.scrollBy(0, -3); document.body.removeChild(dummy); } return SCROLL_ROOT; }; })(); /*********************************************** * PULSE (by Michael Herf) ***********************************************/ /** * Viscous fluid with a pulse for part and decay for the rest. * - Applies a fixed force over an interval (a damped acceleration), and * - Lets the exponential bleed away the velocity over a longer interval * - Michael Herf, http://stereopsis.com/stopping/ */ function pulse_(x) { var val, start, expx; // test x = x * options.pulseScale; if (x < 1) { // acceleartion val = x - (1 - Math.exp(-x)); } else { // tail // the previous animation ended here: start = Math.exp(-1); // simple viscous drag x -= 1; expx = 1 - Math.exp(-x); val = start + (expx * (1 - start)); } return val * options.pulseNormalize; } function pulse(x) { if (x >= 1) return 1; if (x <= 0) return 0; if (options.pulseNormalize == 1) { options.pulseNormalize /= pulse_(1); } return pulse_(x); } /*********************************************** * FIRST RUN ***********************************************/ var userAgent = window.navigator.userAgent; var isEdge = /Edge/.test(userAgent); // thank you MS var isChrome = /chrome/i.test(userAgent) && !isEdge; var isSafari = /safari/i.test(userAgent) && !isEdge; var isMobile = /mobile/i.test(userAgent); var isIEWin7 = /Windows NT 6.1/i.test(userAgent) && /rv:11/i.test(userAgent); var isOldSafari = isSafari && (/Version\/8/i.test(userAgent) || /Version\/9/i.test(userAgent)); var isEnabledForBrowser = (isChrome || isSafari || isIEWin7) && !isMobile; var wheelEvent; if ('onwheel' in document.createElement('div')) wheelEvent = 'wheel'; else if ('onmousewheel' in document.createElement('div')) wheelEvent = 'mousewheel'; if (wheelEvent && isEnabledForBrowser) { addEvent(wheelEvent, wheel); addEvent('mousedown', mousedown); addEvent('load', init); } /*********************************************** * PUBLIC INTERFACE ***********************************************/ function SmoothScroll(optionsToSet) { for (var key in optionsToSet) if (defaultOptions.hasOwnProperty(key)) options[key] = optionsToSet[key]; } SmoothScroll.destroy = cleanup; if (window.SmoothScrollOptions) // async API SmoothScroll(window.SmoothScrollOptions); if (typeof define === 'function' && define.amd) define(function() { return SmoothScroll; }); else if ('object' == typeof exports) module.exports = SmoothScroll; else window.SmoothScroll = SmoothScroll; })(); // source --> https://www.carminedisiero.it/wp-content/plugins/widget-google-reviews/static/js/wpac-time.js?ver=1.8.6 var WPacTime=WPacTime||{getTime:function(a,b,d){return"chat"==d?this.getChatTime(a,b||"en"):d?this.getFormatTime(a,d,b||"en"):this.getDefaultTime(a,b||"en")},getChatTime:function(a,b){var d=((new Date).getTime()-a)/1E3/60/60,c=d/24;return 24>d?this.getFormatTime(a,"HH:mm",b):365>c?this.getFormatTime(a,"dd.MM HH:mm",b):this.getFormatTime(a,"yyyy.MM.dd HH:mm",b)},getDefaultTime:function(a,b){return this.getTimeAgo(a,b)},getTimeAgo:function(a,b){a=((new Date).getTime()-a)/1E3;var d=a/60,c=d/60,e=c/24, f=e/365;b=WPacTime.Messages[b]?b:"en";return 45>a?WPacTime.Messages[b].second:90>a?WPacTime.Messages[b].minute:45>d?WPacTime.Messages[b].minutes(d):90>d?WPacTime.Messages[b].hour:24>c?WPacTime.Messages[b].hours(c):48>c?WPacTime.Messages[b].day:30>e?WPacTime.Messages[b].days(e):60>e?WPacTime.Messages[b].month:365>e?WPacTime.Messages[b].months(e):2>f?WPacTime.Messages[b].year:WPacTime.Messages[b].years(f)},getTime12:function(a,b){a=new Date(a);return(a.getHours()%12?a.getHours()%12:12)+":"+a.getMinutes()+ (12<=a.getHours()?" PM":" AM")},getFormatTime:function(a,b,d){var c=new Date(a),e={SS:c.getMilliseconds(),ss:c.getSeconds(),mm:c.getMinutes(),HH:c.getHours(),hh:(c.getHours()%12?c.getHours()%12:12)+(12<=c.getHours()?"PM":"AM"),dd:c.getDate(),MM:c.getMonth()+1,yyyy:c.getFullYear(),yy:String(c.getFullYear()).toString().substr(2,2),ago:this.getTimeAgo(a,d),12:this.getTime12(a,d)};return b.replace(/(SS|ss|mm|HH|hh|DD|dd|MM|yyyy|yy|ago|12)/g,function(a,b){a=e[b];return 10>a?"0"+a:a})},declineNum:function(a, b,d,c){return a+" "+this.declineMsg(a,b,d,c)},declineMsg:function(a,b,d,c,e){var f=a%10;return 1==f&&(1==a||20f&&(20a)?d:a?c:e}}; WPacTime.Messages={ru:{second:"\u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e",minute:"\u043c\u0438\u043d\u0443\u0442\u0443 \u043d\u0430\u0437\u0430\u0434",minutes:function(a){return WPacTime.declineNum(Math.round(a),"\u043c\u0438\u043d\u0443\u0442\u0430 \u043d\u0430\u0437\u0430\u0434","\u043c\u0438\u043d\u0443\u0442\u044b \u043d\u0430\u0437\u0430\u0434","\u043c\u0438\u043d\u0443\u0442 \u043d\u0430\u0437\u0430\u0434")},hour:"\u0447\u0430\u0441 \u043d\u0430\u0437\u0430\u0434",hours:function(a){return WPacTime.declineNum(Math.round(a), "\u0447\u0430\u0441 \u043d\u0430\u0437\u0430\u0434","\u0447\u0430\u0441\u0430 \u043d\u0430\u0437\u0430\u0434","\u0447\u0430\u0441\u043e\u0432 \u043d\u0430\u0437\u0430\u0434")},day:"\u0434\u0435\u043d\u044c \u043d\u0430\u0437\u0430\u0434",days:function(a){return WPacTime.declineNum(Math.round(a),"\u0434\u0435\u043d\u044c \u043d\u0430\u0437\u0430\u0434","\u0434\u043d\u044f \u043d\u0430\u0437\u0430\u0434","\u0434\u043d\u0435\u0439 \u043d\u0430\u0437\u0430\u0434")},month:"\u043c\u0435\u0441\u044f\u0446 \u043d\u0430\u0437\u0430\u0434", months:function(a){return WPacTime.declineNum(Math.round(a/30),"\u043c\u0435\u0441\u044f\u0446 \u043d\u0430\u0437\u0430\u0434","\u043c\u0435\u0441\u044f\u0446\u0430 \u043d\u0430\u0437\u0430\u0434","\u043c\u0435\u0441\u044f\u0446\u0435\u0432 \u043d\u0430\u0437\u0430\u0434")},year:"\u0433\u043e\u0434 \u043d\u0430\u0437\u0430\u0434",years:function(a){return WPacTime.declineNum(Math.round(a),"\u0433\u043e\u0434 \u043d\u0430\u0437\u0430\u0434","\u0433\u043e\u0434\u0430 \u043d\u0430\u0437\u0430\u0434", "\u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434")}},en:{second:"just now",minute:"1m ago",minutes:function(a){return Math.round(a)+"m ago"},hour:"1h ago",hours:function(a){return Math.round(a)+"h ago"},day:"a day ago",days:function(a){return Math.round(a)+" days ago"},month:"a month ago",months:function(a){return Math.round(a/30)+" months ago"},year:"a year ago",years:function(a){return Math.round(a)+" years ago"}},uk:{second:"\u0442\u0456\u043b\u044c\u043a\u0438 \u0449\u043e",minute:"\u0445\u0432\u0438\u043b\u0438\u043d\u0443 \u0442\u043e\u043c\u0443", minutes:function(a){return WPacTime.declineNum(Math.round(a),"\u0445\u0432\u0438\u043b\u0438\u043d\u0443 \u0442\u043e\u043c\u0443","\u0445\u0432\u0438\u043b\u0438\u043d\u0438 \u0442\u043e\u043c\u0443","\u0445\u0432\u0438\u043b\u0438\u043d \u0442\u043e\u043c\u0443")},hour:"\u0433\u043e\u0434\u0438\u043d\u0443 \u0442\u043e\u043c\u0443",hours:function(a){return WPacTime.declineNum(Math.round(a),"\u0433\u043e\u0434\u0438\u043d\u0443 \u0442\u043e\u043c\u0443","\u0433\u043e\u0434\u0438\u043d\u0438 \u0442\u043e\u043c\u0443", "\u0433\u043e\u0434\u0438\u043d \u0442\u043e\u043c\u0443")},day:"\u0434\u0435\u043d\u044c \u0442\u043e\u043c\u0443",days:function(a){return WPacTime.declineNum(Math.round(a),"\u0434\u0435\u043d\u044c \u0442\u043e\u043c\u0443","\u0434\u043d\u0456 \u0442\u043e\u043c\u0443","\u0434\u043d\u0456\u0432 \u0442\u043e\u043c\u0443")},month:"\u043c\u0456\u0441\u044f\u0446\u044c \u0442\u043e\u043c\u0443",months:function(a){return WPacTime.declineNum(Math.round(a/30),"\u043c\u0456\u0441\u044f\u0446\u044c \u0442\u043e\u043c\u0443", "\u043c\u0456\u0441\u044f\u0446\u0456 \u0442\u043e\u043c\u0443","\u043c\u0456\u0441\u044f\u0446\u0456\u0432 \u0442\u043e\u043c\u0443")},year:"\u0440\u0456\u043a \u0442\u043e\u043c\u0443",years:function(a){return WPacTime.declineNum(Math.round(a),"\u0440\u0456\u043a \u0442\u043e\u043c\u0443","\u0440\u043e\u043a\u0438 \u0442\u043e\u043c\u0443","\u0440\u043e\u043a\u0456\u0432 \u0442\u043e\u043c\u0443")}},ro:{second:"chiar acum",minute:"\u00een urm\u0103 minut",minutes:function(a){return WPacTime.declineNum(Math.round(a), "o minuta in urma","minute in urma","de minute in urma")},hour:"acum o ora",hours:function(a){return WPacTime.declineNum(Math.round(a),"acum o ora","ore in urma","de ore in urma")},day:"o zi in urma",days:function(a){return WPacTime.declineNum(Math.round(a),"o zi in urma","zile in urma","de zile in urma")},month:"o luna in urma",months:function(a){return WPacTime.declineNum(Math.round(a/30),"o luna in urma","luni in urma","de luni in urma")},year:"un an in urma",years:function(a){return WPacTime.declineNum(Math.round(a), "un an in urma","ani in urma","de ani in urma")}},lv:{second:"Maz\u0101k par min\u016bti",minute:"Pirms min\u016btes",minutes:function(a){return WPacTime.declineNum(Math.round(a),"pirms min\u016btes","pirms min\u016bt\u0113m","pirms min\u016bt\u0113m")},hour:"pirms stundas",hours:function(a){return WPacTime.declineNum(Math.round(a),"pirms stundas","pirms stund\u0101m","pirms stund\u0101m")},day:"pirms dienas",days:function(a){return WPacTime.declineNum(Math.round(a),"pirms dienas","pirms dien\u0101m", "pirms dien\u0101m")},month:"pirms m\u0113ne\u0161a",months:function(a){return WPacTime.declineNum(Math.round(a/30),"pirms m\u0113ne\u0161a","pirms m\u0113ne\u0161iem","pirms m\u0113ne\u0161iem")},year:"pirms gada",years:function(a){return WPacTime.declineNum(Math.round(a),"pirms gada","pirms gadiem","pirms gadiem")}},lt:{second:"k\u0105 tik",minute:"prie\u0161 minut\u0119",minutes:function(a){return WPacTime.declineNum(Math.round(a),"minut\u0117 prie\u0161","minut\u0117s prie\u0161","minu\u010di\u0173 prie\u0161")}, hour:"prie\u0161 valand\u0105",hours:function(a){return WPacTime.declineNum(Math.round(a),"valanda prie\u0161","valandos prie\u0161","valand\u0173 prie\u0161")},day:"prie\u0161 dien\u0105",days:function(a){return WPacTime.declineNum(Math.round(a),"diena prie\u0161","dienos prie\u0161","dien\u0173 prie\u0161")},month:"prie\u0161 m\u0117nes\u012f",months:function(a){return WPacTime.declineNum(Math.round(a/30),"m\u0117nes\u012f prie\u0161","m\u0117nesiai prie\u0161","m\u0117nesi\u0173 prie\u0161")}, year:"prie\u0161 metus",years:function(a){return WPacTime.declineNum(Math.round(a),"metai prie\u0161","metai prie\u0161","met\u0173 prie\u0161")}},kk:{second:"\u0431\u0456\u0440 \u043c\u0438\u043d\u0443\u0442\u0442\u0430\u043d \u0430\u0437 \u0443\u0430\u049b\u044b\u0442 \u0431\u04b1\u0440\u044b\u043d",minute:"\u0431\u0456\u0440 \u043c\u0438\u043d\u0443\u0442 \u0431\u04b1\u0440\u044b\u043d",minutes:function(a){return WPacTime.declineNum(Math.round(a),"\u043c\u0438\u043d\u0443\u0442 \u0431\u04b1\u0440\u044b\u043d", "\u043c\u0438\u043d\u0443\u0442 \u0431\u04b1\u0440\u044b\u043d","\u043c\u0438\u043d\u0443\u0442 \u0431\u04b1\u0440\u044b\u043d")},hour:"\u0431\u0456\u0440 \u0441\u0430\u0493\u0430\u0442 \u0431\u04b1\u0440\u044b\u043d",hours:function(a){return WPacTime.declineNum(Math.round(a),"\u0441\u0430\u0493\u0430\u0442 \u0431\u04b1\u0440\u044b\u043d","\u0441\u0430\u0493\u0430\u0442 \u0431\u04b1\u0440\u044b\u043d","\u0441\u0430\u0493\u0430\u0442 \u0431\u04b1\u0440\u044b\u043d")},day:"\u0431\u0456\u0440 \u043a\u04af\u043d \u0431\u04b1\u0440\u044b\u043d", days:function(a){return WPacTime.declineNum(Math.round(a),"\u043a\u04af\u043d \u0431\u04b1\u0440\u044b\u043d","\u043a\u04af\u043d \u0431\u04b1\u0440\u044b\u043d","\u043a\u04af\u043d \u0431\u04b1\u0440\u044b\u043d")},month:"\u0431\u0456\u0440 \u0430\u0439 \u0431\u04b1\u0440\u044b\u043d",months:function(a){return WPacTime.declineNum(Math.round(a/30),"\u0430\u0439 \u0431\u04b1\u0440\u044b\u043d","\u0430\u0439 \u0431\u04b1\u0440\u044b\u043d","\u0430\u0439 \u0431\u04b1\u0440\u044b\u043d")},year:"\u0431\u0456\u0440 \u0436\u044b\u043b \u0431\u04b1\u0440\u044b\u043d", years:function(a){return WPacTime.declineNum(Math.round(a),"\u0436\u044b\u043b \u0431\u04b1\u0440\u044b\u043d","\u0436\u044b\u043b \u0431\u04b1\u0440\u044b\u043d","\u0436\u044b\u043b \u0431\u04b1\u0440\u044b\u043d")}},ka:{second:"\u10ec\u10d0\u10db\u10d8\u10e1 \u10ec\u10d8\u10dc",minute:"\u10ec\u10e3\u10d7\u10d8\u10e1 \u10ec\u10d8\u10dc",minutes:function(a){return WPacTime.declineNum(Math.round(a),"\u10ec\u10e3\u10d7\u10d8\u10e1 \u10ec\u10d8\u10dc","\u10ec\u10e3\u10d7\u10d8\u10e1 \u10ec\u10d8\u10dc", "\u10ec\u10e3\u10d7\u10d8\u10e1 \u10ec\u10d8\u10dc")},hour:"\u10e1\u10d0\u10d0\u10d7\u10d8\u10e1 \u10ec\u10d8\u10dc",hours:function(a){return WPacTime.declineNum(Math.round(a),"\u10e1\u10d0\u10d0\u10d7\u10d8\u10e1 \u10ec\u10d8\u10dc","\u10e1\u10d0\u10d0\u10d7\u10d8\u10e1 \u10ec\u10d8\u10dc","\u10e1\u10d0\u10d0\u10d7\u10d8\u10e1 \u10ec\u10d8\u10dc")},day:"\u10d3\u10e6\u10d8\u10e1 \u10ec\u10d8\u10dc",days:function(a){return WPacTime.declineNum(Math.round(a),"\u10d3\u10e6\u10d8\u10e1 \u10ec\u10d8\u10dc", "\u10d3\u10e6\u10d8\u10e1 \u10ec\u10d8\u10dc","\u10d3\u10e6\u10d8\u10e1 \u10ec\u10d8\u10dc")},month:"\u10d7\u10d5\u10d8\u10e1 \u10ec\u10d8\u10dc",months:function(a){return WPacTime.declineNum(Math.round(a/30),"\u10d7\u10d5\u10d8\u10e1 \u10ec\u10d8\u10dc","\u10d7\u10d5\u10d8\u10e1 \u10ec\u10d8\u10dc","\u10d7\u10d5\u10d8\u10e1 \u10ec\u10d8\u10dc")},year:"\u10ec\u10da\u10d8\u10e1 \u10ec\u10d8\u10dc",years:function(a){return WPacTime.declineNum(Math.round(a),"\u10ec\u10da\u10d8\u10e1 \u10ec\u10d8\u10dc", "\u10ec\u10da\u10d8\u10e1 \u10ec\u10d8\u10dc","\u10ec\u10da\u10d8\u10e1 \u10ec\u10d8\u10dc")}},hy:{second:"\u0574\u056b \u0584\u0576\u056b \u057e\u0561\u0575\u0580\u056f\u0575\u0561\u0576 \u0561\u057c\u0561\u057b",minute:"\u0574\u0565\u056f \u0580\u0578\u057a\u0565 \u0561\u057c\u0561\u057b",minutes:function(a){return WPacTime.declineNum(Math.round(a),"\u0580\u0578\u057a\u0565 \u0561\u057c\u0561\u057b","\u0580\u0578\u057a\u0565 \u0561\u057c\u0561\u057b","\u0580\u0578\u057a\u0565 \u0561\u057c\u0561\u057b")}, hour:"\u0574\u0565\u056f \u056a\u0561\u0574 \u0561\u057c\u0561\u057b",hours:function(a){return WPacTime.declineNum(Math.round(a),"\u056a\u0561\u0574 \u0561\u057c\u0561\u057b","\u056a\u0561\u0574 \u0561\u057c\u0561\u057b","\u056a\u0561\u0574 \u0561\u057c\u0561\u057b")},day:"\u0574\u0565\u056f \u0585\u0580 \u0561\u057c\u0561\u057b",days:function(a){return WPacTime.declineNum(Math.round(a),"\u0585\u0580 \u0561\u057c\u0561\u057b","\u0585\u0580 \u0561\u057c\u0561\u057b","\u0585\u0580 \u0561\u057c\u0561\u057b")}, month:"\u0574\u0565\u056f \u0561\u0574\u056b\u057d \u0561\u057c\u0561\u057b",months:function(a){return WPacTime.declineNum(Math.round(a/30),"\u0561\u0574\u056b\u057d \u0561\u057c\u0561\u057b","\u0561\u0574\u056b\u057d \u0561\u057c\u0561\u057b","\u0561\u0574\u056b\u057d \u0561\u057c\u0561\u057b")},year:"\u0574\u0565\u056f \u057f\u0561\u0580\u056b \u0561\u057c\u0561\u057b",years:function(a){return WPacTime.declineNum(Math.round(a),"\u057f\u0561\u0580\u056b \u0561\u057c\u0561\u057b","\u057f\u0561\u0580\u056b \u0561\u057c\u0561\u057b", "\u057f\u0561\u0580\u056b \u0561\u057c\u0561\u057b")}},fr:{second:"tout \u00e0 l'heure",minute:"environ une minute",minutes:function(a){return Math.round(a)+" minutes"},hour:"environ une heure",hours:function(a){return"environ "+Math.round(a)+" heures"},day:"un jour",days:function(a){return Math.round(a)+" jours"},month:"environ un mois",months:function(a){return Math.round(a/30)+" mois"},year:"environ un an",years:function(a){return Math.round(a)+" ans"}},es:{second:"ahora",minute:"hace un minuto", minutes:function(a){return"hace "+Math.round(a)+" minuts"},hour:"hace una hora",hours:function(a){return"hace "+Math.round(a)+" horas"},day:"hace un dia",days:function(a){return"hace "+Math.round(a)+" d\u00edas"},month:"hace un mes",months:function(a){return"hace "+Math.round(a/30)+" meses"},year:"hace a\u00f1os",years:function(a){return"hace "+Math.round(a)+" a\u00f1os"}},el:{second:"\u03bb\u03b9\u03b3\u03cc\u03c4\u03b5\u03c1\u03bf \u03b1\u03c0\u03cc \u03ad\u03bd\u03b1 \u03bb\u03b5\u03c0\u03c4\u03cc", minute:"\u03b3\u03cd\u03c1\u03c9 \u03c3\u03c4\u03bf \u03ad\u03bd\u03b1 \u03bb\u03b5\u03c0\u03c4\u03cc",minutes:function(a){return Math.round(a)+" minutes"},hour:"\u03b3\u03cd\u03c1\u03c9 \u03c3\u03c4\u03b7\u03bd \u03bc\u03b9\u03b1 \u03ce\u03c1\u03b1",hours:function(a){return"about "+Math.round(a)+" hours"},day:"\u03bc\u03b9\u03b1 \u03bc\u03ad\u03c1\u03b1",days:function(a){return Math.round(a)+" days"},month:"\u03b3\u03cd\u03c1\u03c9 \u03c3\u03c4\u03bf\u03bd \u03ad\u03bd\u03b1 \u03bc\u03ae\u03bd\u03b1", months:function(a){return Math.round(a/30)+" months"},year:"\u03b3\u03cd\u03c1\u03c9 \u03c3\u03c4\u03bf\u03bd \u03ad\u03bd\u03b1 \u03c7\u03c1\u03cc\u03bd\u03bf",years:function(a){return Math.round(a)+" years"}},de:{second:"soeben",minute:"vor einer Minute",minutes:function(a){return"vor "+Math.round(a)+" Minuten"},hour:"vor einer Stunde",hours:function(a){return"vor "+Math.round(a)+" Stunden"},day:"vor einem Tag",days:function(a){return"vor "+Math.round(a)+" Tagen"},month:"vor einem Monat",months:function(a){return"vor "+ Math.round(a/30)+" Monaten"},year:"vor einem Jahr",years:function(a){return"vor "+Math.round(a)+" Jahren"}},be:{second:"\u043c\u0435\u043d\u0448 \u0437\u0430 \u0445\u0432\u0456\u043b\u0456\u043d\u0443 \u0442\u0430\u043c\u0443",minute:"\u0445\u0432\u0456\u043b\u0456\u043d\u0443 \u0442\u0430\u043c\u0443",minutes:function(a){return WPacTime.declineNum(Math.round(a),"\u0445\u0432\u0456\u043b\u0456\u043d\u0430 \u0442\u0430\u043c\u0443","\u0445\u0432\u0456\u043b\u0456\u043d\u044b \u0442\u0430\u043c\u0443", "\u0445\u0432\u0456\u043b\u0456\u043d \u0442\u0430\u043c\u0443")},hour:"\u0433\u0430\u0434\u0437\u0456\u043d\u0443 \u0442\u0430\u043c\u0443",hours:function(a){return WPacTime.declineNum(Math.round(a),"\u0433\u0430\u0434\u0437\u0456\u043d\u0443 \u0442\u0430\u043c\u0443","\u0433\u0430\u0434\u0437\u0456\u043d\u044b \u0442\u0430\u043c\u0443","\u0433\u0430\u0434\u0437\u0456\u043d \u0442\u0430\u043c\u0443")},day:"\u0434\u0437\u0435\u043d\u044c \u0442\u0430\u043c\u0443",days:function(a){return WPacTime.declineNum(Math.round(a), "\u0434\u0437\u0435\u043d\u044c \u0442\u0430\u043c\u0443","\u0434\u043d\u0456 \u0442\u0430\u043c\u0443","\u0434\u0437\u0451\u043d \u0442\u0430\u043c\u0443")},month:"\u043c\u0435\u0441\u044f\u0446 \u0442\u0430\u043c\u0443",months:function(a){return WPacTime.declineNum(Math.round(a/30),"\u043c\u0435\u0441\u044f\u0446 \u0442\u0430\u043c\u0443","\u043c\u0435\u0441\u044f\u0446\u0430 \u0442\u0430\u043c\u0443","\u043c\u0435\u0441\u044f\u0446\u0430\u045e \u0442\u0430\u043c\u0443")},year:"\u0433\u043e\u0434 \u0442\u0430\u043c\u0443", years:function(a){return WPacTime.declineNum(Math.round(a),"\u0433\u043e\u0434 \u0442\u0430\u043c\u0443","\u0433\u0430\u0434\u044b \u0442\u0430\u043c\u0443","\u0433\u043e\u0434 \u0442\u0430\u043c\u0443")}},it:{second:"proprio ora",minute:"un minuto fa",minutes:function(a){return WPacTime.declineNum(Math.round(a),"un minuto fa","minuti fa","minuti fa")},hour:"un'ora fa",hours:function(a){return WPacTime.declineNum(Math.round(a),"un'ora fa","ore fa","ore fa")},day:"un giorno fa",days:function(a){return WPacTime.declineNum(Math.round(a), "un giorno fa","giorni fa","giorni fa")},month:"un mese fa",months:function(a){return WPacTime.declineNum(Math.round(a/30),"un mese fa","mesi fa","mesi fa")},year:"un anno fa",years:function(a){return WPacTime.declineNum(Math.round(a),"un anno fa","anni fa","anni fa")}},tr:{second:"az \u00f6nce",minute:"dakika \u00f6nce",minutes:function(a){return Math.round(a)+" dakika \u00f6nce"},hour:"saat \u00f6nce",hours:function(a){return Math.round(a)+" saat \u00f6nce"},day:"g\u00fcn \u00f6nce",days:function(a){return Math.round(a)+ " g\u00fcn \u00f6nce"},month:"ay \u00f6nce",months:function(a){return Math.round(a/30)+" ay \u00f6nce"},year:"y\u0131l \u00f6nce",years:function(a){return Math.round(a)+" y\u0131l \u00f6nce"}},nb:{second:"n\u00e5 nettopp",minute:"ett minutt siden",minutes:function(a){return Math.round(a)+" minutter siden"},hour:"en time siden",hours:function(a){return Math.round(a)+" timer siden"},day:"en dag siden",days:function(a){return Math.round(a)+" dager siden"},month:"en m\u00e5ned siden",months:function(a){return Math.round(a/ 30)+" m\u00e5neder siden"},year:"ett \u00e5r siden",years:function(a){return Math.round(a)+" \u00e5r siden"}},da:{second:"lige nu",minute:"et minut siden",minutes:function(a){return Math.round(a)+" minutter siden"},hour:"en time siden",hours:function(a){return Math.round(a)+" timer siden"},day:"en dag siden",days:function(a){return Math.round(a)+" dage siden"},month:"en m\u00e5ned siden",months:function(a){return Math.round(a/30)+" m\u00e5neder siden"},year:"et \u00e5r siden",years:function(a){return Math.round(a)+ " \u00e5r siden"}},nl:{second:"zojuist",minute:"minuten geleden",minutes:function(a){return Math.round(a)+" minuten geleden"},hour:"uur geleden",hours:function(a){return Math.round(a)+" uur geleden"},day:"dagen geleden",days:function(a){return Math.round(a)+" dagen geleden"},month:"maand geleden",months:function(a){return Math.round(a/30)+" maanden geleden"},year:"jaar geleden",years:function(a){return Math.round(a)+" jaar geleden"}},ca:{second:"ara mateix",minute:"fa un minut",minutes:function(a){return"fa "+ Math.round(a)+" minuts"},hour:"fa una hora",hours:function(a){return"fa "+Math.round(a)+" hores"},day:"fa un dia",days:function(a){return"fa "+Math.round(a)+" dies"},month:"fa un mes",months:function(a){return"fa "+Math.round(a/30)+" mesos"},year:"fa un any",years:function(a){return"fa "+Math.round(a)+" anys"}},sv:{second:"just nu",minute:"en minut sen",minutes:function(a){return Math.round(a)+" minuter sen"},hour:"en timme sen",hours:function(a){return Math.round(a)+" timmar sen"},day:"en dag sen", days:function(a){return Math.round(a)+" dagar sen"},month:"en m\u00e5nad sen",months:function(a){return Math.round(a/30)+" m\u00e5nader sen"},year:"en \u00e5r sen",years:function(a){return Math.round(a)+" \u00e5r sen"}},pl:{second:"w\u0142a\u015bnie teraz",minute:"minut\u0119 temu",minutes:function(a){return Math.round(a)+" minut temu"},hour:"godzin\u0119 temu",hours:function(a){return Math.round(a)+" godzin temu"},day:"wczoraj",days:function(a){return Math.round(a)+" dni temu"},month:"miesi\u0105c temu", months:function(a){return Math.round(a/30)+" miesi\u0119cy temu"},year:"rok temu",years:function(a){return Math.round(a)+" lat temu"}},pt:{second:"agora",minute:"1 minuto atr\u00e1s",minutes:function(a){return Math.round(a)+" minutos atr\u00e1s"},hour:"1 hora atr\u00e1s",hours:function(a){return Math.round(a)+" horas atr\u00e1s"},day:"1 dia atr\u00e1s",days:function(a){return Math.round(a)+" dias atr\u00e1s"},month:"1 m\u00eas atr\u00e1s",months:function(a){return Math.round(a/30)+" meses atr\u00e1s"}, year:"1 ano atr\u00e1s",years:function(a){return Math.round(a)+" anos atr\u00e1s"}},hu:{second:"\u00e9pp az im\u00e9nt",minute:"1 perccel ezel\u0151tt",minutes:function(a){return Math.round(a)+" perccel ezel\u0151tt"},hour:"\u00f3r\u00e1val ezel\u0151tt",hours:function(a){return Math.round(a)+" \u00f3r\u00e1val ezel\u0151tt"},day:"nappal ezel\u0151tt",days:function(a){return Math.round(a)+" nappal ezel\u0151tt"},month:"h\u00f3nappal ezel\u0151tt",months:function(a){return Math.round(a/30)+" h\u00f3nappal ezel\u0151tt"}, year:"\u00e9vvel ezel\u0151tt",years:function(a){return Math.round(a)+" \u00e9vvel ezel\u0151tt"}},fi:{second:"juuri nyt",minute:"minuutti sitten",minutes:function(a){return Math.round(a)+" minuuttia sitten"},hour:"tunti sitten",hours:function(a){return Math.round(a)+" tuntia sitten"},day:"p\u00e4iv\u00e4 sitten",days:function(a){return Math.round(a)+" p\u00e4iv\u00e4\u00e4 sitten"},month:"kuukausi sitten",months:function(a){return Math.round(a/30)+" kuukautta sitten"},year:"vuosi sitten",years:function(a){return Math.round(a)+ " vuotta sitten"}},he:{second:"\u05d4\u05e8\u05d2\u05e2",minute:"\u05dc\u05e4\u05e0\u05d9 \u05d3\u05e7\u05d4",minutes:function(a){return"\u05dc\u05e4\u05e0\u05d9 "+Math.round(a)+" \u05d3\u05e7\u05d5\u05ea"},hour:"\u05dc\u05e4\u05e0\u05d9 \u05e9\u05e2\u05d4",hours:function(a){return"\u05dc\u05e4\u05e0\u05d9 "+Math.round(a)+" \u05e9\u05e2\u05d5\u05ea"},day:"\u05dc\u05e4\u05e0\u05d9 \u05d9\u05d5\u05dd",days:function(a){return"\u05dc\u05e4\u05e0\u05d9 "+Math.round(a)+" \u05d9\u05de\u05d9\u05dd"},month:"\u05dc\u05e4\u05e0\u05d9 \u05d7\u05d5\u05d3\u05e9", months:function(a){return 2==Math.round(a/30)?"\u05dc\u05e4\u05e0\u05d9 \u05d7\u05d5\u05d3\u05e9\u05d9\u05d9\u05dd":"\u05dc\u05e4\u05e0\u05d9 "+Math.round(a/30)+" \u05d7\u05d5\u05d3\u05e9\u05d9\u05dd"},year:"\u05dc\u05e4\u05e0\u05d9 \u05e9\u05e0\u05d4",years:function(a){return"\u05dc\u05e4\u05e0\u05d9 "+Math.round(a)+" \u05e9\u05e0\u05d9\u05dd"}},bg:{second:"\u0432 \u043c\u043e\u043c\u0435\u043d\u0442\u0430",minute:"\u043f\u0440\u0435\u0434\u0438 1 \u043c\u0438\u043d\u0443\u0442\u0430",minutes:function(a){return"\u043f\u0440\u0435\u0434\u0438 "+ Math.round(a)+" \u043c\u0438\u043d\u0443\u0442\u0438"},hour:"\u043f\u0440\u0435\u0434\u0438 1 \u0447\u0430\u0441",hours:function(a){return"\u043f\u0440\u0435\u0434\u0438 "+Math.round(a)+" \u0447\u0430\u0441\u0430"},day:"\u043f\u0440\u0435\u0434\u0438 1 \u0434\u0435\u043d",days:function(a){return"\u043f\u0440\u0435\u0434\u0438 "+Math.round(a)+" \u0434\u043d\u0438"},month:"\u043f\u0440\u0435\u0434\u0438 1 \u043c\u0435\u0441\u0435\u0446",months:function(a){return"\u043f\u0440\u0435\u0434\u0438 "+Math.round(a/ 30)+" \u043c\u0435\u0441\u0435\u0446\u0430"},year:"\u043f\u0440\u0435\u0434\u0438 1 \u0433\u043e\u0434\u0438\u043d\u0430",years:function(a){return"\u043f\u0440\u0435\u0434\u0438 "+Math.round(a)+" \u0433\u043e\u0434\u0438\u043d\u0438"}},sk:{second:"pr\u00e1ve teraz",minute:"pred min\u00fatov",minutes:function(a){return"pred "+Math.round(a)+" min\u00fatami"},hour:"pred hodinou",hours:function(a){return"pred "+Math.round(a)+" hodinami"},day:"v\u010dera",days:function(a){return"pred "+Math.round(a)+" d\u0148ami"}, month:"pred mesiacom",months:function(a){return"pred "+Math.round(a/30)+" mesiacmi"},year:"pred rokom",years:function(a){return"pred "+Math.round(a)+" rokmi"}}};